예제 #1
0
    /// <summary>
    /// 通过RoleID初始化一个角色的BaseRoleData信息(hp默认为最大值)
    /// </summary>
    public BaseRoleData InitRoleData(int roleId)
    {
        string key = roleId.ToString();
        //获取角色的Level
        int roleLevel = PlayerprefsManager.LoadRoleLevel(roleId);
        //获取该角色的基础数据与成长系数
        string         roleName   = (string)OriginRoleJsonData[key]["name"];
        ProfessionType profession = (ProfessionType)((int)OriginRoleJsonData[key]["profession"]);
        string         head       = (string)OriginRoleJsonData[key]["head"];
        string         info       = (string)OriginRoleJsonData[key]["info"];
        int            str        = (int)OriginRoleJsonData[key]["str"];
        int            strAdd     = (int)OriginRoleJsonData[key]["strAdd"];
        int            agi        = (int)OriginRoleJsonData[key]["agi"];
        int            agiAdd     = (int)OriginRoleJsonData[key]["agiAdd"];
        int            Int        = (int)OriginRoleJsonData[key]["int"];
        int            IntAdd     = (int)OriginRoleJsonData[key]["intAdd"];
        int            speed      = (int)OriginRoleJsonData[key]["speed"];
        int            speedAdd   = (int)OriginRoleJsonData[key]["speedAdd"];
        int            maxHP      = (int)OriginRoleJsonData[key]["maxHP"];
        int            maxHPAdd   = (int)OriginRoleJsonData[key]["maxHPAdd"];

        //初始化属性 默认满血量
        BaseRoleData roleData = new BaseRoleData(roleId, roleName, profession, roleLevel, head, info, maxHP, maxHPAdd, str, strAdd, agi, agiAdd, Int, IntAdd, speed, speedAdd);

        return(roleData);
    }
예제 #2
0
 public Job(ProfessionType profession, int monthlySalary, int workHoursPerDay, DateTime startDate)
 {
     Profession      = profession;
     MonthlySalary   = monthlySalary;
     WorkHoursPerDay = workHoursPerDay;
     StartDate       = startDate;
 }
예제 #3
0
    /// <summary>
    /// 获得一个职业的名称
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public static string GetProfessionName(ProfessionType type)
    {
        string value = string.Empty;

        switch (type)
        {
        case ProfessionType.Beginner:
            value = "初心者";
            break;

        case ProfessionType.TreasureHunter:
            value = "初心者";
            break;

        case ProfessionType.Saber:
            value = "剑士";
            break;

        case ProfessionType.Archer:
            value = "弓兵";
            break;

        case ProfessionType.Caster:
            value = "法师";
            break;

        default:
            break;
        }
        return(value);
    }
        public static void InitPrefix(ProfessionDetailPanel __instance, ProfessionType type)
        {
            //We don't add this panel for Soldier or NoJob
            if (type != ProfessionType.Soldier && type != ProfessionType.NoJob)
            {
                //Checks if we already initialized the Specialization Panel.  If so, do nothing
                SpecializationPanel p = __instance.GetComponentInChildren <SpecializationPanel>(true);
                if (p != null)
                {
                    return;
                }

                //Get the parent of the original panel
                GameObject parent = __instance.specializationTogglePanel.transform.parent.gameObject;

                //Create our own panel
                GameObject newSpecPanel = GameObject.Instantiate(ModHandler.mods.gameObjects["SpecializationPanelModded"], parent.transform);
                p = newSpecPanel.GetComponent <SpecializationPanel>();
                p.Init(type, AbsoluteProfessionPrioritiesMod.GetSpecializationDescriptors()[type].Values.ToList());

                //For the collapse button to work, we need to add our panel to the accordion
                //We also remove the original panel from it
                AccordionPanel aPanel = __instance.GetComponent <AccordionPanel>();
                aPanel.accordionObjects.Add(newSpecPanel);
                aPanel.accordionObjects.Remove(__instance.specializationTogglePanel.gameObject);

                //Removing the original panel from the UI would cause bugs so instead we just disable it
                __instance.specializationTogglePanel.gameObject.SetActive(false);
            }
        }
예제 #5
0
 public IActionResult ListById([Required] int pid, ProfessionType type)
 {
     if (ModelState.IsValid)
     {
         var list = _context.VProfessionMaps.Where(p => p.InstituteId == pid && p.ProfessionType == type).Select(pro => new
         {
             id            = pro.ProfessionId,
             name          = pro.Name,
             instituteName = pro.InstituteName,
             instituteId   = pro.InstituteId,
             type          = pro.ProfessionType == ProfessionType.PostGraduate ? "研究生专业" : "本科生专业"
         });
         return(Json(new
         {
             professions = list
         }));
     }
     else
     {
         return(Json(new
         {
             isOk = false,
             error = "参数错误! 传递了错误的参数!"
         }));
     }
 }
        private void OnClickRoleType(int type)
        {
            ProfessionType pfType = (ProfessionType)type;

            switch (pfType)
            {
            case ProfessionType.Warrior:
                GameEntry.Entity.ShowPoseRole(m_WarriorData);
                m_SelectRoleTypeId = m_WarriorTypeId;
                GameEntry.Entity.CheckHideEntity(m_MasterData.Id);
                GameEntry.Entity.CheckHideEntity(m_ShooterData.Id);
                break;

            case ProfessionType.Master:
                GameEntry.Entity.ShowPoseRole(m_MasterData);
                m_SelectRoleTypeId = m_MasterTypeId;
                GameEntry.Entity.CheckHideEntity(m_WarriorData.Id);
                GameEntry.Entity.CheckHideEntity(m_ShooterData.Id);
                break;

            case ProfessionType.Shoooter:
                GameEntry.Entity.ShowPoseRole(m_ShooterData);
                m_SelectRoleTypeId = m_ShooterTypeId;
                GameEntry.Entity.CheckHideEntity(m_MasterData.Id);
                GameEntry.Entity.CheckHideEntity(m_WarriorData.Id);
                break;
            }
        }
예제 #7
0
        public static bool SetPriority_Prefix(ProfessionManager __instance, ProfessionType type, int priority, HumanAI human)
        {
            priority = Mathf.Clamp(priority, 0, MaxPriority);
            if (!__instance.CanHaveProfession(human))
            {
                return(false);
            }

            __instance.professions[type].SetPriorityDirectly(priority);

            // only one at max priority
            if (priority == MaxPriority && type != ProfessionType.Builder)
            {
                foreach (Profession profession in __instance.professions.Values)
                {
                    if (profession.type != type && profession.type != ProfessionType.Builder && profession.priority == MaxPriority)
                    {
                        __instance.SetPriority(profession.type, MaxPriority - 1, human);
                    }
                }
            }

            // cancel work
            if (priority == 0)
            {
                human.AbortInteractionsWhere(x => ProfessionManager.workInteractions[type].Contains(x.interaction));
            }

            // tutorial
            WorldScripts.Instance.tutorialManager.HasAssignedProfession();
            return(false);
        }
예제 #8
0
        public PoseRoleData(int entityId, int typeId)
            : base(entityId, typeId)
        {
            IDataTable <DRPoseRole> dtPoseRole = GameEntry.DataTable.GetDataTable <DRPoseRole>();
            DRPoseRole drPoseRole = dtPoseRole.GetDataRow(TypeId);

            if (drPoseRole == null)
            {
                return;
            }

            m_ProfessionType = (ProfessionType)drPoseRole.ProfessionType;
            m_Effect01Data   = new EffectData(GameEntry.Entity.GenerateTempSerialId(), drPoseRole.Effect01)
            {
                KeepTime  = drPoseRole.Effect01Duration,
                DelayTime = drPoseRole.Effect01Delay
            };

            m_Effect02Data = new EffectData(GameEntry.Entity.GenerateTempSerialId(), drPoseRole.Effect02)
            {
                KeepTime  = drPoseRole.Effect02Duration,
                DelayTime = drPoseRole.Effect02Delay
            };

            m_SoundId    = drPoseRole.SoundId;
            m_SoundDelay = drPoseRole.SoundDelay;
        }
예제 #9
0
        private void RefreshView()
        {
            RefreshButton();

            curUnitData = controller.GetUnitProto(unitId);

            controller.CalculateData(curUnitData);

            string str = curUnitData.Name;

            string [] str2 = str.Split('/');

            if (str2.Length == 2)
            {
                unitNameText.text = string.Format("<color=#1a8af1>{0}</color>  {1}", str2[0], str2[1]);
            }

            ProfessionType type = ( ProfessionType )curUnitData.ProfessionType;

            ShowUnitTypeImage(type);

            if (type == ProfessionType.TramcarType || type == ProfessionType.DemolisherType)
            {
                unitBuy.gameObject.SetActive(false);
                attackDescriptionButton.gameObject.SetActive(false);
                skillDescriptionButton.gameObject.SetActive(false);
            }
            else
            {
                unitBuy.gameObject.SetActive(true);
                attackDescriptionButton.gameObject.SetActive(true);
                skillDescriptionButton.gameObject.SetActive(true);

                int[] prices = controller.GetUnitCost(unitId);
                diamondCostText.text = prices[0].ToString();
                goldCostText.text    = prices[1].ToString();
            }

            int unitNumber = 0;

            currentUnits.TryGetValue(unitId, out unitNumber);
            numberTextBg.gameObject.SetActive(unitNumber != 0);
            numberText.text = string.Format(" 已拥有\t<color=#00FF00>X{0}</color>", unitNumber);

            DestroyShowModel();

            if (curUnitData.show_model_res > 0)
            {
                DataManager.GetInstance().AddMainMenuCacheId(curUnitData.show_model_res);
                DataManager.GetInstance().AddMainMenuCacheId(curUnitData.show_effect_res);
                loadManager.LoadAssetAsync <GameObject, int>(curUnitData.show_model_res, LoadModel, curUnitData.show_model_res);
                loadManager.LoadAssetAsync <GameObject, int>(curUnitData.show_effect_res, LoadModelEffect, curUnitData.show_model_res);
            }
            else
            {
                DebugUtils.Log(DebugUtils.Type.UI, "No character models were found, id:" + curUnitData.show_model_res);
            }
        }
예제 #10
0
        public static bool HigherPriorityLoop_Prefix(ProfessionDetailPanel __instance)
        {
            HumanAI        human = __instance.GetFieldValue <HumanAI>("human");
            ProfessionType type  = __instance.GetPropertyValue <ProfessionType>("type");

            int prio = human.professionManager.GetProfession(type).priority + 1;

            human.professionManager.SetPriority(type, prio, human);
            __instance.InvokeMethod("UpdatePriority");

            return(false);
        }
예제 #11
0
        public Specialization(ProfessionType profession, string name, int priority, bool active, SubSpecialization[] subs)
        {
            this.Profession = profession;
            this.Name       = name;
            this.Priority   = priority;
            this.Active     = active;

            for (int i = 0; i < subs.Length; i++)
            {
                this.SubSpecializations.Add(subs[i].Name, subs[i]);
                subs[i].Priority = i;
            }
        }
예제 #12
0
        private void OnClickRoleType(int type)
        {
            ProfessionType pfType = (ProfessionType)type;

            switch (pfType)
            {
            case ProfessionType.Warrior:
                GameEntry.Entity.ShowPoseRole(m_WarriorData);
                m_SelectRoleTypeId = (int)EntityTypeId.PlayerWarrior;

                if (GameEntry.Entity.HasEntity(m_MasterData.Id))
                {
                    GameEntry.Entity.HideEntity(m_MasterData.Id);
                }
                if (GameEntry.Entity.HasEntity(m_ShooterData.Id))
                {
                    GameEntry.Entity.HideEntity(m_ShooterData.Id);
                }
                break;

            case ProfessionType.Master:
                GameEntry.Entity.ShowPoseRole(m_MasterData);
                m_SelectRoleTypeId = (int)EntityTypeId.PlayerMaster;

                if (GameEntry.Entity.HasEntity(m_WarriorData.Id))
                {
                    GameEntry.Entity.HideEntity(m_WarriorData.Id);
                }
                if (GameEntry.Entity.HasEntity(m_ShooterData.Id))
                {
                    GameEntry.Entity.HideEntity(m_ShooterData.Id);
                }
                break;

            case ProfessionType.Shoooter:
                GameEntry.Entity.ShowPoseRole(m_ShooterData);
                m_SelectRoleTypeId = (int)EntityTypeId.PlayerShooter;

                if (GameEntry.Entity.HasEntity(m_MasterData.Id))
                {
                    GameEntry.Entity.HideEntity(m_MasterData.Id);
                }
                if (GameEntry.Entity.HasEntity(m_WarriorData.Id))
                {
                    GameEntry.Entity.HideEntity(m_WarriorData.Id);
                }
                break;
            }
        }
예제 #13
0
        public Person(int x, int y)
            : base(x, y, 1, 1, texturesMap[ProfessionType.Worker])
        {
            age = 0;
            education = 0;
            gender = GenderType.Male;
            health = HEALTH_MAX;
            profession = ProfessionType.Worker;
            Random random = new Random();
            direction = (DirectionType)(random.Next() % (int)DirectionType.SIZE);
            remainingMovement = movementRange = 36;
            BlocksMovement = false;

            Name = "Person";
        }
예제 #14
0
        private void OnClickRoleType(int type)
        {
            ProfessionType pfType = (ProfessionType)type;

            switch (pfType)
            {
            case ProfessionType.Warrior:
                GameEntry.Entity.ShowPoseRole(warriorData);

                if (GameEntry.Entity.HasEntity(masterData.Id))
                {
                    GameEntry.Entity.HideEntity(masterData.Id);
                }
                if (GameEntry.Entity.HasEntity(shooterData.Id))
                {
                    GameEntry.Entity.HideEntity(shooterData.Id);
                }
                break;

            case ProfessionType.Master:
                GameEntry.Entity.ShowPoseRole(masterData);

                if (GameEntry.Entity.HasEntity(warriorData.Id))
                {
                    GameEntry.Entity.HideEntity(warriorData.Id);
                }
                if (GameEntry.Entity.HasEntity(shooterData.Id))
                {
                    GameEntry.Entity.HideEntity(shooterData.Id);
                }
                break;

            case ProfessionType.Shoooter:
                GameEntry.Entity.ShowPoseRole(shooterData);

                if (GameEntry.Entity.HasEntity(masterData.Id))
                {
                    GameEntry.Entity.HideEntity(masterData.Id);
                }
                if (GameEntry.Entity.HasEntity(warriorData.Id))
                {
                    GameEntry.Entity.HideEntity(warriorData.Id);
                }
                break;
            }
        }
        /// <summary>
        /// Initializes the panel
        /// </summary>
        /// <param name="pType">The profession type</param>
        /// <param name="specializations">Specializations of the profession</param>
        /// <param name="upButton">The template of the Up button</param>
        /// <param name="downButton">The template of the Down button</param>
        /// <param name="toggle">The template of the Toggle</param>
        public void Init(ProfessionType pType, List <SpecializationDescriptor> specializations)
        {
            this.ProfessionType = pType;

            //For each specialization, create a detail panel
            foreach (var spec in specializations)
            {
                GameObject specObj = GameObject.Instantiate(this.DetailsPanelTemplate, this.Content);
                SpecializationDetailsPanel panel = specObj.GetComponent <SpecializationDetailsPanel>();
                panel.Init(this, spec, specializations.Count - 1);
                panel.SpecializationToggle.UpButton.onClick.AddListener(() => PriorityButtonUpClicked(panel));
                panel.SpecializationToggle.DownButton.onClick.AddListener(() => PriorityButtonDownClicked(panel));
                DetailPanels.Add(panel);
            }

            OrderDetailPanels();
        }
예제 #16
0
        public static void UpdatePriority_Postfix(ProfessionDetailPanel __instance)
        {
            HumanAI        human         = __instance.GetFieldValue <HumanAI>("human");
            ProfessionType type          = __instance.GetPropertyValue <ProfessionType>("type");
            Image          priorityImage = __instance.GetFieldValue <Image>("priorityImage");

            Sprite starsFour = ModHandler.mods.sprites["starsFour"];

            int priority = human.professionManager.GetProfession(type).priority;

            if (priority == 4)
            {
                priorityImage.sprite = starsFour;
            }

            __instance.priorityHigherButton.SetIsPressable(priority < MaxPriority);
        }
예제 #17
0
        internal static void DisplaySelectProfession()
        {
            GUILayout.BeginHorizontal();
            // at first initialization in Create Mode, Selected Kerbal is null...
            if (SelectedKerbal != null && SelectedKerbal.SalaryContractDispute)
            {
                GUI.enabled = false;
            }
            GUILayout.Label("Profession:", GUILayout.Width(80));

            var isPilot = KerbalProfession == ProfessionType.Pilot.ToString();

            isPilot = GUILayout.Toggle(isPilot, "Pilot", GUILayout.Width(70));
            if (isPilot)
            {
                _typeOfProfession = ProfessionType.Pilot;
            }

            var isEngineer = KerbalProfession == ProfessionType.Engineer.ToString();

            isEngineer = GUILayout.Toggle(isEngineer, "Engineer", GUILayout.Width(80));
            if (isEngineer)
            {
                _typeOfProfession = ProfessionType.Engineer;
            }

            var isScientist = KerbalProfession == ProfessionType.Scientist.ToString();

            isScientist = GUILayout.Toggle(isScientist, "Scientist", GUILayout.Width(80));
            if (isScientist)
            {
                _typeOfProfession = ProfessionType.Scientist;
            }

            var isTourist = KerbalProfession == ProfessionType.Tourist.ToString();

            isTourist = GUILayout.Toggle(isTourist, "Tourist", GUILayout.Width(80));
            if (isTourist)
            {
                _typeOfProfession = ProfessionType.Tourist;
            }

            GUI.enabled = true;
            GUILayout.EndHorizontal();
        }
예제 #18
0
 public BaseRoleData(int roleID, string roleName, ProfessionType profession, int level, int hP, string head, string info, int maxHPBase, int maxHPAdd, int strBase, int strAdd, int agiBase, int agiAdd, int intBase, int intAdd, int speedBase, int speedAdd)
 {
     RoleID     = roleID;
     RoleName   = roleName;
     Profession = profession;
     Level      = level;
     HP         = hP;
     Head       = head;
     Info       = info;
     MaxHPBase  = maxHPBase;
     MaxHPAdd   = maxHPAdd;
     StrBase    = strBase;
     StrAdd     = strAdd;
     AgiBase    = agiBase;
     AgiAdd     = agiAdd;
     IntBase    = intBase;
     IntAdd     = intAdd;
     SpeedBase  = speedBase;
     SpeedAdd   = speedAdd;
 }
예제 #19
0
        private void ShowUnitTypeImage(ProfessionType type)
        {
            Image tempImage;

            unitTypeImageDic.TryGetValue(type, out tempImage);

            if (tempImage != null)
            {
                foreach (Image item in unitTypeImageDic.Values)
                {
                    item.gameObject.SetActive(false);
                }

                tempImage.gameObject.SetActive(true);
            }
            else
            {
                DebugUtils.LogError(DebugUtils.Type.UI, string.Format("The unit type icon can't find.Check this hero type {0}", type));
            }
        }
예제 #20
0
        private static void SetProfessionFlag()
        {
            switch (SelectedKerbal.Trait)
            {
            case "Pilot":
                _typeOfProfession = ProfessionType.Pilot;
                break;

            case "Engineer":
                _typeOfProfession = ProfessionType.Engineer;
                break;

            case "Scientist":
                _typeOfProfession = ProfessionType.Scientist;
                break;

            default:
                _typeOfProfession = ProfessionType.Tourist;
                break;
            }
        }
        private void InitColonistForProfession(HumanAI human, ProfessionType profession,
                                               Dictionary <string, SpecializationDescriptor> descriptors,
                                               Dictionary <ProfessionType, Dictionary <string, Specialization> > profSpecs)
        {
            if (!profSpecs.ContainsKey(profession))
            {
                profSpecs.Add(profession, new Dictionary <string, Specialization>());
            }
            else
            {
                foreach (var specName in profSpecs[profession].Keys.ToArray().Where(x => !descriptors.ContainsKey(x)))
                {
                    profSpecs[profession].Remove(specName);
                }
            }

            foreach (var specName in descriptors.Keys.ToArray())
            {
                InitColonistForSpecialization(human, specName, descriptors[specName], profSpecs[profession]);
            }
        }
예제 #22
0
 public IJob CreateJob(ProfessionType profession, int monthlySalary, int workHoursPerDay, DateTime startDate)
 {
     return(new Job(profession, monthlySalary, workHoursPerDay, startDate));
 }
 public SpecializationDescriptor(ProfessionType profession, string name)
 {
     this.Profession = profession;
     this.Name       = name;
 }
예제 #24
0
 /// <inheritdoc />
 public Task <Profession> GetAsync(ProfessionType id, CancellationToken cancellationToken = default) =>
 this.GetAsync(id.ToString(), cancellationToken);
예제 #25
0
 public static Texture2D GetTexture(ProfessionType profession)
 {
     return texturesMap[profession];
 }
        public static void HandleRegister(Client pClient, MsgRegister pMsg)
        {
            Client trash;

            if (pMsg.CancelRequest)
            {
                try
                {
                    pClient.Disconnect();
                }
                catch
                {
                    ServerKernel.Players.TryRemove(pClient.Identity, out trash);
                    ServerKernel.CharacterCreation.TryRemove(pClient.Identity, out trash);
                    ServerKernel.CharacterCreation.TryRemove(pClient.AccountIdentity, out trash);
                }
                return;
            }

            if (ServerKernel.CharacterCreation.TryGetValue(pClient.AccountIdentity, out trash))
            {
                trash = null;

                if (CheckName(pMsg.Name))
                {
                    var pRepository = new CharacterRepository();
                    if (pRepository.AccountHasCharacter(pClient.AccountIdentity))
                    {
                        //DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.AccountHasCharacter);
                        pClient.Send(ServerMessages.CharacterCreation.AccountHasCharacter);
                        return;
                    }
                    if (pRepository.CharacterExists(pMsg.Name))
                    {
                        //DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.NameTaken);
                        pClient.Send(ServerMessages.CharacterCreation.NameTaken);
                        return;
                    }

                    ProfessionType profession = ((ProfessionType)pMsg.Profession > ProfessionType.INTERN_TAOIST
                        ? ProfessionType.INTERN_TAOIST
                        : (ProfessionType)(pMsg.Profession / 10 * 10));
                    if (!Enum.IsDefined(typeof(BodyType), pMsg.Body) ||
                        !Enum.IsDefined(typeof(ProfessionType), profession))
                    {
                        // The client is a proxy exploiting the server. Disconnect the client.
                        DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.AccessDenied);
                        return;
                    }

                    switch (profession)
                    {
                    case ProfessionType.INTERN_ARCHER:
                    case ProfessionType.INTERN_NINJA:
                    case ProfessionType.INTERN_TAOIST:
                    case ProfessionType.INTERN_TROJAN:
                    case ProfessionType.INTERN_WARRIOR:
                    case ProfessionType.INTERN_MONK:
                        break;

                    default:
                    {
                        DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.AccessDenied);
                        return;
                    }
                    }

                    ushort hair     = 410;
                    uint   lookface = 0;
                    if (pMsg.Body == (ushort)BodyType.THIN_MALE || pMsg.Body == (ushort)BodyType.HEAVY_MALE)
                    {
                        if ((pMsg.Profession / 10) == 5)
                        {
                            lookface = (uint)(new Random().Next(103, 107));
                        }
                        else if ((pMsg.Profession / 10) == 6)
                        {
                            lookface = (uint)(new Random().Next(109, 113));
                        }
                        else
                        {
                            lookface = (uint)(new Random().Next(1, 102));
                        }
                    }
                    else
                    {
                        hair = 410;
                        if ((pMsg.Profession / 10) == 5)
                        {
                            lookface = (uint)(new Random().Next(291, 295));
                        }
                        else if ((pMsg.Profession / 10) == 6)
                        {
                            lookface = (uint)(new Random().Next(300, 304));
                        }
                        else
                        {
                            lookface = (uint)(new Random().Next(201, 290));
                        }
                    }

                    #region Initial HairStyle and Lookface for monks
                    switch (profession)
                    {
                    case ProfessionType.INTERN_MONK:
                        if (pMsg.Body == (ushort)BodyType.THIN_MALE)
                        {
                            lookface = (uint)(new Random().Next(109, 113));
                            hair     = 400;
                        }
                        else if (pMsg.Body == (ushort)BodyType.HEAVY_MALE)
                        {
                            lookface = (uint)(new Random().Next(129, 133));
                            hair     = 400;
                        }
                        else if (pMsg.Body == (ushort)BodyType.THIN_FEMALE)
                        {
                            lookface = (uint)(new Random().Next(300, 304));
                        }
                        else if (pMsg.Body == (ushort)BodyType.HEAVY_FEMALE)
                        {
                            lookface = (uint)(new Random().Next(325, 329));
                        }
                        break;
                    }
                    #endregion

                    DbPointAllot points =
                        ServerKernel.PointAllot.Values.FirstOrDefault(
                            x => x.Profession == ((pMsg.Profession - (pMsg.Profession % 10)) / 10) && x.Level == 1);
                    if (points == null)
                    {
                        pClient.Send(new MsgTalk("Could not fetch class attribute points.", ChatTone.CHARACTER_CREATION));
                        return;
                    }

                    int    idx    = new Random().Next(m_startX.Length - 1);
                    ushort startX = m_startX[idx];
                    ushort startY = m_startY[idx];

                    switch (profession)
                    {
                    case ProfessionType.INTERN_TROJAN:
                    case ProfessionType.INTERN_WARRIOR:
                    case ProfessionType.INTERN_ARCHER:
                    case ProfessionType.INTERN_NINJA:
                    case ProfessionType.INTERN_TAOIST:
                    case ProfessionType.INTERN_MONK:
                    {
                        break;
                    }

                    default:
                        DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.AccessDenied);
                        return;
                    }

                    uint money = 100000, emoney = 25;

                    ushort startLife = (ushort)(((points.Agility + points.Strength + points.Spirit) * 3) + points.Vitality * 24);

                    var newUser = new DbUser
                    {
                        AccountId           = pClient.AccountIdentity,
                        Name                = pMsg.Name,
                        Lookface            = pMsg.Body + (lookface * 10000),
                        Profession          = (byte)profession,
                        Mate                = "None",
                        AdditionalPoints    = 0,
                        Agility             = points.Agility,
                        Strength            = points.Strength,
                        Vitality            = points.Vitality,
                        Spirit              = points.Spirit,
                        AutoAllot           = 1,
                        AutoExercise        = 0,
                        BoundEmoney         = 4300,
                        Business            = 255,
                        CoinMoney           = 0,
                        CurrentLayout       = 0,
                        Donation            = 0,
                        Emoney              = emoney,
                        Experience          = 0,
                        Level               = 1,
                        FirstProfession     = 0,
                        Metempsychosis      = 0,
                        Flower              = 0,
                        HomeId              = 0,
                        LastLogin           = 0,
                        LastLogout          = 0,
                        LastProfession      = 0,
                        Life                = startLife,
                        LockKey             = 0,
                        Hair                = hair,
                        Mana                = 0,
                        MapId               = _START_MAP,
                        MapX                = startX,
                        MapY                = startY,
                        MeteLevel           = 0,
                        Money               = money,
                        MoneySaved          = 0,
                        Orchids             = 0,
                        PkPoints            = 0,
                        RedRoses            = 0,
                        StudentPoints       = 0,
                        Tulips              = 0,
                        Virtue              = 0,
                        WhiteRoses          = 0,
                        EnlightPoints       = 0,
                        HeavenBlessing      = (uint)(UnixTimestamp.Timestamp() + 60 * 60 * 24 * 30),
                        ExperienceExpires   = (uint)(UnixTimestamp.Timestamp() + 60 * 60 * 24),
                        ExperienceMultipler = 10
                    };

                    if (pRepository.CreateNewCharacter(newUser))
                    {
                        uint idUser = newUser.Identity;

                        try
                        {
                            GenerateInitialStatus(idUser, profession);
                        }
                        catch
                        {
                            ServerKernel.Log.SaveLog("Could not create initial status for character " + idUser, true, LogType.ERROR);
                        }
                        ServerKernel.Log.SaveLog(string.Format("User [({0}){1}] has created character {2}.",
                                                               pClient.AccountIdentity, idUser, newUser.Name), true);

                        pClient.Send(ServerMessages.CharacterCreation.AnswerOk);
                        return;
                    }
                }
                else
                {
                    //DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.InvalidName);
                    pClient.Send(ServerMessages.CharacterCreation.InvalidName);
                    return;
                }
            }
            else
            {
                DisconnectWithMsg(pClient, ServerMessages.CharacterCreation.AccessDenied);
                return;
            }
        }
        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
        }
예제 #28
0
        /// <summary>
        /// 完成日志记录
        /// </summary>
        /// <param name="name"></param>
        /// <param name="instituteId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public IActionResult Create([Required] String name, [Required] int instituteId, ProfessionType type)
        {
            if (ModelState.IsValid)
            {
                if (!_analysis.GetLoginUserConfig(HttpContext).Power.SystemInfoManager)
                {
                    return(Json(new
                    {
                        isOk = false,
                        error = "你并无信息管理操作权限"
                    }));
                }
                if (_context.Institute.Any(val => val.InstituteId == instituteId))
                {
                    if (_context.Professions.Any(pro => pro.Name.Equals(name) && pro.ProfessionType == type))  //同一类型下的
                    {
                        return(Json(new
                        {
                            isOk = false,
                            error = "此专业已经存在,名称重复"
                        }));
                    }
                    else
                    {
                        LogPricipalOperation log =
                            _logger.GetDefaultLogPricipalOperation(
                                PrincpalOperationCode.ProfessionAdd,
                                $"添加一个新的专业",
                                $"新专业名称: {name}");
                        log.PrincpalOperationStatus = PrincpalOperationStatus.Success;
                        _context.LogPricipalOperations.Add(log);

                        Profession profession = new Profession();
                        profession.Name           = name;
                        profession.InstituteId    = instituteId;
                        profession.ProfessionType = type;
                        _context.Professions.Add(profession);
                        _context.SaveChanges();
                        return(Json(new
                        {
                            isOk = true,
                            info = "添加成功"
                        }));
                    }
                }
                else
                {
                    return(Json(new
                    {
                        isOk = false,
                        error = "所属学院不存在"
                    }));
                }
            }
            else
            {
                return(Json(new
                {
                    isOk = false,
                    error = "参数错误! 传递了错误的参数!"
                }));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SkillProgressionFormulaInput"/> class.
 /// </summary>
 /// <param name="skillType">The type of skill.</param>
 /// <param name="currentSkillLevel">The current skill level.</param>
 /// <param name="professionType">The current profession.</param>
 public SkillProgressionFormulaInput(SkillType skillType, uint currentSkillLevel, ProfessionType professionType)
 {
     this.SkillType    = skillType;
     this.CurrentLevel = currentSkillLevel;
     this.Profession   = professionType;
 }
예제 #30
0
        private static IEnumerable <InteractionInfo> GetNextInteraction(WorkInteractionController __instance, HumanAI human, ProfessionType profession)
        {
            //Get all the specializations for this human for this profession
            List <Specialization> specs = AbsoluteProfessionPrioritiesMod.Instance.ColonistsData[human.GetID()][profession].Values.ToList();

            specs = specs.Where(x => x.Active).OrderBy(x => UnityEngine.Random.Range(0f, 1f)).OrderBy(x => x.Priority).ToList();

            foreach (var spec in specs)
            {
                foreach (var interaction in spec.GetNextInteraction(human))
                {
                    yield return(interaction);
                }
            }
        }
예제 #31
0
 public Profession(Stat s, ProfessionType profession = ProfessionType.Adventurer)
 {
     this.BaseStats = s;
     this.type      = profession;
     Skills         = SkillDao.GetSkillsByProfession(profession);
 }
예제 #32
0
 public MineCrystalSpecialization(ProfessionType profession, int priority, bool active, SubSpecialization[] subs)
     : base(profession, "mineCrystal", priority, active, subs)
 {
 }