DarkEmu_GameServer.Systems.BreakItem C# (CSharp) Метод

BreakItem() публичный Метод

public BreakItem ( ) : void
Результат void
        public void BreakItem()
        {
            try
            {
                //Checks before we continue
                if (Character.Stall.Stallactive || Character.Action.nAttack || Character.Action.sAttack || Character.Alchemy.working)
                    return;
                //Set bool
                Character.Alchemy.working = true;
                //TODO: Timer for alchemy start / end
                PacketReader reader = new PacketReader(PacketInformation.buffer);
                byte rondorequired = reader.Byte();
                byte slot = reader.Byte();
                reader.Close();

                //Get our item information (item)
                Global.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0);

                //Get our degree information
                byte itemdegree = Data.ItemBase[item.ID].Degree;

                //First we get our elements (Same degree as weapon)
                //This should return 4 items
                //Add check rondo count if high enough.
                Character.Alchemy.Elementlist = GetDegreeElements(item.ID, Character);
                //Check if the item has any blues on it.
                if (Data.ItemBlue[item.dbID].totalblue != 0)
                    Character.Alchemy.StonesList = GetStonesDegree(item.ID, Character);

                //Check current free slots of the player
                byte slotcheck = GetFreeSlot();
                //If slot amount is lower then 4 return
                //Slots free must be 6 i believe because of stones (TODO: Check info official).
                if (slotcheck < 4)
                {
                    //Send error message inventory full ...
                    return;
                }
                //Player has enough slots so we continue adding the new items
                else
                {
                    //Update rondo quantity
                    Character.Information.InventorylistSlot = GetPlayerItems(Character);
                    foreach (byte e in Character.Information.InventorylistSlot)
                    {
                        //Set slotitem
                        Global.slotItem itemrondoinfo = GetItem((uint)Character.Information.CharacterID, e, 0);
                        if (itemrondoinfo.ID != 0)
                        {
                            if (Data.ItemBase[itemrondoinfo.ID].Etctype == Global.item_database.EtcType.DESTROYER_RONDO)
                            {
                                //Update amount
                                itemrondoinfo.Amount -= rondorequired;
                                ItemUpdateAmount(itemrondoinfo, Character.Information.CharacterID);
                            }
                        }
                    }
                    //Clean our list
                    Character.Information.InventorylistSlot.Clear();
                    //Remove the item used in dissembling (Query).
                    MsSQL.DeleteData("DELETE FROM char_items WHERE id='"+ item.dbID +"' AND owner='"+ Character.Information.CharacterID +"'");
                    //Remove the item used in dissembling (Visual).
                    ItemUpdateAmount(item, Character.Information.CharacterID);
                    //Send packet #2
                    client.Send(Packet.DestroyItem());
                    //Repeat for each element in our list.
                    foreach (int e in Character.Alchemy.Elementlist)
                    {
                        if (e != 0)
                        {
                            //TODO: Make detailed randoms
                            //Make random add count for the elements
                            //NOTE: Check what item has what element on destruction. if pk2 contains or not.
                            int elementamount = 0;

                            #region Amounts
                            if (Data.ItemBase[item.ID].Degree == 1)
                                elementamount = rnd.Next(1, 60);
                            else if (Data.ItemBase[item.ID].Degree == 2)
                                elementamount = rnd.Next(1, 90);
                            else if (Data.ItemBase[item.ID].Degree == 3)
                                elementamount = rnd.Next(1, 120);
                            else if (Data.ItemBase[item.ID].Degree == 4)
                                elementamount = rnd.Next(1, 150);
                            else if (Data.ItemBase[item.ID].Degree == 5)
                                elementamount = rnd.Next(1, 200);
                            else if (Data.ItemBase[item.ID].Degree == 6)
                                elementamount = rnd.Next(1, 250);
                            else if (Data.ItemBase[item.ID].Degree == 7)
                                elementamount = rnd.Next(1, 300);
                            else if (Data.ItemBase[item.ID].Degree == 8)
                                elementamount = rnd.Next(1, 375);
                            else if (Data.ItemBase[item.ID].Degree == 9)
                                elementamount = rnd.Next(1, 450);
                            else if (Data.ItemBase[item.ID].Degree == 10)
                                elementamount = rnd.Next(1, 600);
                            else if (Data.ItemBase[item.ID].Degree == 11)
                                elementamount = rnd.Next(1, 800);
                            #endregion

                            int stoneamount = 0;

                            #region Stones
                            if (Data.ItemBlue[item.dbID].totalblue != 0)
                            {
                                if (Data.ItemBlue[item.dbID].totalblue == 1)
                                    stoneamount = rnd.Next(0, 1);
                                else if (Data.ItemBlue[item.dbID].totalblue == 2)
                                    stoneamount = rnd.Next(0, 2);
                            }
                            #endregion

                            slotcheck = GetFreeSlot();
                            //Stack items todo
                            AddItem(Data.ItemBase[e].ID, 10, slotcheck, Character.Information.CharacterID, 0);
                            client.Send(Packet.GainElements(slotcheck, Data.ItemBase[e].ID, (short)elementamount));
                        }
                    }
                    //Clear created list content.
                    Character.Alchemy.Elementlist.Clear();
                }
                //Reset bool
                Character.Alchemy.working = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Alchemy error destroyer {0}",ex);
            }
        }

Usage Example

Пример #1
0
        public static void oPCode(Decode de)
        {
            try
            {
                Systems sys = (Systems)de.Packet;
                sys.PacketInformation = de;
                //Console.WriteLine("Recv: (0x{0})", de.opcode.ToString("X4"));
                switch (de.opcode)
                {
                case 0x7481:
                    break;

                case CLIENT_PING:
                case CLIENT_PING2:
                    break;

                case CLIENT_PATCH:
                    sys.Patch();
                    break;

                case CLIENT_CONNECTION:
                    sys.Connect();
                    break;

                case CLIENT_CHARACTERSCREEN:
                    sys.CharacterScreen();
                    sys.Ping();
                    break;

                case CLIENT_INGAME_REQUEST:
                    sys.IngameLogin();
                    break;

                case CLIENT_INGAME_SUCCESS:
                    sys.InGameSuccess();
                    break;

                case CLIENT_REQUEST_WEATHER:
                    sys.LoadWeather();
                    break;

                case CLIENT_SIT:
                    sys.Doaction();
                    break;

                case CLIENT_QUESTMARK:
                    sys.QuestionMark();
                    break;

                case CLIENT_MOVEMENT:
                    sys.Movement();
                    break;

                case CLIENT_ANGLE_MOVE:
                    sys.Angle();
                    break;

                case CLIENT_SAVE_BAR:
                    sys.Save();
                    break;

                case CLIENT_LEAVE_REQUEST:
                    sys.LeaveGame();
                    break;

                case CLIENT_LEAVE_CANCEL:
                    sys.CancelLeaveGame();
                    break;

                case CLIENT_ITEM_MOVE:
                    sys.ItemMain();
                    break;

                case CLIENT_SELECT_OBJECT:
                    sys.SelectObject();
                    break;

                case CLIENT_GM:
                    sys.GM();
                    break;

                case CLIENT_EMOTE:
                    sys.Emote();
                    break;

                case CLIENT_TELEPORTSTART:
                    sys.Teleport_Start();
                    break;

                case CLIENT_TELEPORTDATA:
                    sys.Teleport_Data();
                    break;

                case CLIENT_CHAT:
                    sys.Chat();
                    break;

                case CLIENT_MAINACTION:
                    sys.ActionMain();
                    break;

                case CLIENT_MASTERY_UP:
                    sys.Mastery_Up();
                    break;

                case CLIENT_SKILL_UP:
                    sys.Mastery_Skill_Up();
                    break;

                case CLIENT_GETUP:
                    sys.Player_Up();
                    break;

                case CLIENT_REQUEST_PARTY:
                    sys.NormalRequest();
                    break;

                case CLIENT_PARTY_REQUEST:
                    sys.CharacterRequest();
                    break;

                case CLIENT_EXCHANGE_REQUEST:
                    sys.Exchange_Request();
                    break;

                case CLIENT_EXCHANGE_WINDOWS_CLOSE:
                    sys.Exchange_Close();
                    break;

                case CLIENT_EXCHANGE_ACCEPT:
                    sys.Exchange_Accept();
                    break;

                case CLIENT_EXCHANGE_APPROVE:
                    sys.Exchange_Approve();
                    break;

                case CLIENT_PARTY_ADDMEMBERS:
                    sys.PartyAddmembers();
                    break;

                case CLIENT_PARTY_LEAVE:
                    sys.LeaveParty();
                    break;

                case CLIENT_PARTY_BANPLAYER:
                    sys.PartyBan();
                    break;

                case CLIENT_GUIDE:
                    sys.Gameguide();
                    break;

                case CLIENT_PLAYER_UPDATE_INT:
                    sys.InsertInt();
                    break;

                case CLIENT_PLAYER_UPDATE_STR:
                    sys.InsertStr();
                    break;

                case CLIENT_PLAYER_HANDLE:
                    sys.Handle();
                    break;

                case CLIENT_PLAYER_BERSERK:
                    sys.Player_Berserk_Up();
                    break;

                case CLIENT_CLOSE_NPC:
                    sys.Close_NPC();
                    break;

                case CLIENT_OPEN_NPC:
                    sys.Open_NPC();
                    break;

                case CLIENT_NPC_BUYPACK:
                    sys.Player_BuyPack();
                    break;

                case CLIENT_OPEN_WAREHOUSE:
                    sys.Open_Warehouse();
                    break;

                case CLIENT_CLOSE_SCROLL:
                    sys.StopScrollTimer();
                    break;

                case CLIENT_SAVE_PLACE:
                    sys.SavePlace();
                    break;

                case CLIENT_ALCHEMY:
                    sys.AlchemyElixirMain();
                    break;

                case CLIENT_ALCHEMY_CREATE_STONE:
                    sys.AlchemyCreateStone();
                    break;

                case CLIENT_PET_MOVEMENT:
                    sys.MovementPet();
                    break;

                case CLIENT_PET_TERMINATE:
                    sys.HandleClosePet();
                    break;

                case CLIENT_PARTYMATCHING_LIST_REQUEST:
                    sys.ListPartyMatching(Party);
                    break;

                case CLIENT_CREATE_FORMED_PARTY:
                    sys.CreateFormedParty();
                    break;

                case CLIENT_FORMED_PARTY_DELETE:
                    sys.DeleteFormedParty(0);
                    break;

                case CLIENT_JOIN_FORMED_RESPONSE:
                    sys.FormedResponse();
                    break;

                case CLIENT_CHANGE_PARTY_NAME:
                    sys.RenameParty();
                    break;

                case CLIENT_JOIN_FORMED_PARTY:
                    sys.JoinFormedParty();
                    break;

                case CLIENT_START_PK:
                    sys.PkPlayer();
                    break;

                case CLIENT_GUILD:
                    sys.GuildCreate();
                    break;

                case CLIENT_GUILD_TRANSFER:
                    sys.GuildTransferLeaderShip();
                    break;

                case CLIENT_GUILD_PERMISSIONS:
                    sys.GuildPermissions();
                    break;

                case CLIENT_GUILD_PROMOTE:
                    sys.GuildPromote();
                    break;

                case CLIENT_GUILD_DISBAND:
                    sys.GuildDisband();
                    break;

                case CLIENT_GUILD_MESSAGE:
                    sys.GuildMessage();
                    break;

                case CLIENT_OPEN_GUILD_STORAGE:
                    sys.GuildStorage();
                    break;

                case CLIENT_CLOSE_GUILD_STORAGE:
                    sys.GuildStorageClose();
                    break;

                case CLIENT_GUILD_WAR_GOLD:
                    sys.GuildWarGold();
                    break;

                case CLIENT_OPEN_GUILD_STORAGE2:
                    sys.GuildStorage2();
                    break;

                case CLIENT_GUILD_KICK:
                    sys.KickFromGuild();
                    break;

                case CLIENT_GUILD_LEAVE:
                    sys.GuildLeave();
                    break;

                case CLIENT_GUILD_TITLE_SET:
                    sys.GuildTitle();
                    break;

                case CLIENT_GUILD_INVITE:
                    sys.GuildInvite();
                    break;

                case CLIENT_GUILD_DONATE_GP:
                    sys.DonateGP();
                    break;

                case CLIENT_GACHA_PLAY:
                    //Add function
                    break;

                case CLIENT_JOIN_MERC:
                    sys.JoinMerc();
                    break;

                case CLIENT_RANKING_LISTS:
                    sys.RankList();
                    break;

                case CLIENT_PREV_JOB:
                    sys.PrevJob();
                    break;

                case CLIENT_HONOR_RANK:
                    sys.HonorRank();
                    break;

                case CLIENT_PM_MESSAGE:
                    sys.PrivateMessage();
                    break;

                case CLIENT_PM_SEND:
                    sys.PrivateMessageSend();
                    break;

                case CLIENT_PM_OPEN:
                    sys.PrivateMessageOpen();
                    break;

                case CLIENT_PM_DELETE:
                    sys.PrivateMessageDelete();
                    break;

                case CLIENT_PET_UNSUMMON:
                    sys.UnSummonPet();
                    break;

                case CLIENT_PET_RENAME:
                    sys.RenamePet();
                    break;

                case CLIENT_GPET_SETTINGS:
                    sys.GrabPetSettings();
                    break;

                case CLIENT_MAKE_ALIAS:
                    sys.MakeAlias();
                    break;

                case CLIENT_LEAVE_JOB:
                    sys.LeaveJob();
                    break;

                case CLIENT_DISSEMBLE_ITEM:
                    sys.BreakItem();
                    break;

                case CLIENT_STALL_OPEN:
                    sys.StallOpen();
                    break;

                case CLIENT_STALL_CLOSE:
                    sys.StallClose();
                    break;

                case CLIENT_STALL_BUY:
                    sys.StallBuy();
                    break;

                case CLIENT_STALL_ACTION:
                    sys.StallMain();
                    break;

                case CLIENT_STALL_OTHER_OPEN:
                    sys.EnterStall();
                    break;

                case CLIENT_STALL_OTHER_CLOSE:
                    sys.LeaveStall();
                    break;

                case CLIENT_PVP:
                    sys.StartPvpTimer(10000);
                    break;

                case CLIENT_ALCHEMY_STONE:
                    sys.AlchemyStoneMain();
                    break;

                case CLIENT_ITEM_MALL_WEB:
                    sys.ItemMallWeb();
                    break;

                case CLIENT_ITEM_STORAGE_BOX:
                    sys.ItemStorageBox();
                    break;

                case CLIENT_ITEM_BOX_LOG:
                    sys.ItemStorageBoxLog();
                    break;

                case CLIENT_FRIEND_REMOVAL:
                    sys.FriendRemoval();
                    break;

                case CLIENT_FRIEND_INVITE:
                    sys.FriendAdd();
                    break;

                case CLIENT_FRIEND_GROUP:
                    sys.FriendGroup("ADD");
                    break;

                case CLIENT_FRIEND_GROUP_REMOVE:
                    sys.FriendGroup("REMOVE");
                    break;

                case CLIENT_FRIEND_GROUP_MANAGE_FRIEND:
                    sys.FriendGroup("MOVE");
                    break;

                case CLIENT_FRIEND_INVITE_RESPONSE:
                    sys.FriendAddResponse();
                    break;

                case CLIENT_UNION_APPLY:
                    sys.unionapply();
                    break;

                case CLIENT_ICON_REQUEST:
                    sys.RequestIcons();
                    break;

                default:
                    Print.Format("(0x{0}) {1}", de.opcode.ToString("X4"), Decode.StringToPack(sys.PacketInformation.buffer));
                    break;
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Systems