コード例 #1
0
        public bool Create(uint idMgc, ushort level)
        {
            m_dbMagictype = ServerKernel.Magictype.Values.FirstOrDefault(x => x.Type == idMgc && x.Level == level);
            if (m_dbMagictype == null)
            {
                ServerKernel.Log.GmLog("magic_fail", string.Format("Skill not existent for creation (type:{0}, level:{1}, player: {2})", idMgc, 0, m_pOwner.Identity));
                return(false);
            }

            if (m_pOwner.Magics.CheckType((ushort)idMgc))
            {
                return(false);
            }

            m_dbMagic = new DbMagic
            {
                OwnerId = m_pOwner.Identity,
                Type    = (ushort)idMgc,
                Level   = level
            };

            m_pPacket = new MsgMagicInfo(0, level, (ushort)idMgc);
            GetSetMaxLevel();
            if (m_pOwner is Character)
            {
                Save();
                SendSkill();
            }
            SetDelay();
            return(true);
        }
コード例 #2
0
 public bool Create(DbMagic pMgc)
 {
     m_dbMagictype = ServerKernel.Magictype.Values.FirstOrDefault(x => x.Type == pMgc.Type && x.Level == pMgc.Level);
     if (m_dbMagictype == null)
     {
         ServerKernel.Log.GmLog("magic_fail", string.Format("Skill not existent (type:{0}, level:{1}, player: {2})", pMgc.Type, pMgc.Level, m_pOwner.Identity));
         return(false);
     }
     m_dbMagic = pMgc;
     m_pPacket = new MsgMagicInfo(pMgc.Experience, pMgc.Level, pMgc.Type);
     GetSetMaxLevel();
     SetDelay();
     return(true);
 }
コード例 #3
0
        private static void GenerateInitialStatus(uint idRole, ProfessionType profession)
        {
            Item item = null;

            uint[] dwMonkItems    = { 143006, 120006, 136006, 300000, 610026, 610026, 151016, 160016, 201006, 202006, 203006 };
            uint[] dwTrojanItems  = { 118006, 120006, 130006, 300000, 410026, 480026, 150016, 160016, 201006, 202006, 203006 };
            uint[] dwWarriorItems = { 111006, 120006, 131006, 300000, 561026, 150016, 160016, 201006, 202006, 203006 };
            uint[] dwTaoistItems  = { 114006, 121006, 134006, 300000, 421026, 152016, 160016, 201006, 202006, 203006 };
            uint[] dwArcherItems  = { 113006, 120006, 133006, 300000, 500016, 150016, 160016, 201006, 202006, 203006 };
            uint[] dwNinjaItems   = { 112006, 120006, 135006, 300000, 601026, 601026, 150016, 160016, 201006, 202006, 203006 };

            #region Class Items

            for (int i = 0; i < 9; i++)
            {
                item = new Item
                {
                    StackAmount = 1
                };
                switch (i)
                {
                case 0:
                case 1:
                case 2:
                {
                    item.Type           = 1000000;
                    item.PlayerIdentity = idRole;
                    break;
                }

                case 3:
                case 4:
                case 5:
                {
                    item.Type           = 1001000;
                    item.PlayerIdentity = idRole;
                    break;
                }

                case 6:     // BeginnerPackLv1
                {
                    item.Type           = 723753;
                    item.PlayerIdentity = idRole;
                    break;
                }

                case 7:
                {
                    switch (profession)
                    {
                    case ProfessionType.INTERN_MONK:
                        item.Type = 610301;
                        break;

                    case ProfessionType.INTERN_NINJA:
                        item.Type = 601301;
                        break;

                    case ProfessionType.INTERN_TAOIST:
                        item.Type = 421301;
                        break;

                    case ProfessionType.INTERN_ARCHER:
                        item.Type = 501301;
                        break;

                    default:
                        item.Type = 410301;
                        break;
                    }
                    item.Position       = ItemPosition.RIGHT_HAND;
                    item.PlayerIdentity = idRole;
                    break;
                }

                case 8:
                {
                    item.Type           = 132005;
                    item.Position       = ItemPosition.ARMOR;
                    item.PlayerIdentity = idRole;
                    break;
                }
                }
                item.Save();
            }

            #endregion

            #region Extra items

            uint[] list = { };

            switch (profession)
            {
            case ProfessionType.INTERN_MONK:
                list = dwMonkItems;
                break;

            case ProfessionType.INTERN_TROJAN:
                list = dwTrojanItems;
                break;

            case ProfessionType.INTERN_WARRIOR:
                list = dwWarriorItems;
                break;

            case ProfessionType.INTERN_ARCHER:
                list = dwArcherItems;
                break;

            case ProfessionType.INTERN_TAOIST:
                list = dwTaoistItems;
                break;

            case ProfessionType.INTERN_NINJA:
                list = dwNinjaItems;
                break;
            }

            foreach (var idType in list)
            {
                item = new Item
                {
                    Type           = idType,
                    PlayerIdentity = idRole,
                    Bound          = true,
                    Plus           = 0,
                    Position       = 0,
                    StackAmount    = 1
                };
                //if (!item.IsMount() && (item.GetItemSubtype() < 200 || item.GetItemSubtype() > 203))
                //{
                //    item.ReduceDamage = 3;
                //    item.Enchantment = 100;
                //}
                //if (item.IsEquipment()
                //    && (item.GetItemSubtype() < 200 || item.GetItemSubtype() > 203)
                //    && item.Type != 300000)
                //{
                //    if (profession == ProfessionType.TAOIST)
                //    {
                //        item.SocketOne = SocketGem.REFINED_PHOENIX_GEM;
                //    }
                //    else
                //    {
                //        item.SocketOne = SocketGem.REFINED_DRAGON_GEM;
                //    }
                //}
                //else if (item.GetItemSubtype() == 201)
                //{
                //    item.SocketOne = SocketGem.REFINED_THUNDER_GEM;
                //}
                //else if (item.GetItemSubtype() == 202)
                //{
                //    item.SocketOne = SocketGem.REFINED_GLORY_GEM;
                //}
                item.Save();
            }

            #endregion

            #region Starting Skills

            switch (profession)
            {
            case ProfessionType.INTERN_MONK:
            {
                DbMagic mgc = new DbMagic
                {
                    OwnerId = idRole,
                    Type    = 10490
                };
                Database.Magics.SaveOrUpdate(mgc);
                break;
            }
            }

            #endregion
        }