示例#1
0
        public static void UpdateNPC()
        {
            user.dialogWindow.fxNPCIconPB.Image    = NPC.GetIcon();
            user.dialogWindow.fxNPCNameLabel.Text  = NPC.GetName();
            user.dialogWindow.fxNPCGroupLabel.Text = NPC.GetGroup();

            dialog_tree = NPC.GetDialogs();
            UpdateDialog();
        }
示例#2
0
        private static void FightAttack()
        {
            if (ChanceToHit())
            {
                if (actionFromActor)
                {
                    NPC.EditHealth((actor.skills[0].value * -5));
                    actor.Stamina -= (50 - actor.skills[2].value * 4);

                    user.fightWindow.fxResultOfActionText.AppendText(actor.name + " нанёс удар " + NPC.GetName() + ".\n" +
                                                                     NPC.GetName() + " получен урон: " + actor.skills[0].value * 5 + ".\n\n");

                    if (NPC.GetHealth() == 0)
                    {
                        user.fightWindow.fxResultOfActionText.AppendText(actor.name + " убил " + NPC.GetName());
                        actor.inFight = false;
                        user.mainGameWindow.fxResumeFightBtn.Enabled = false;

                        user.fightWindow.fxAttackBtn.Enabled  = false;
                        user.fightWindow.fxDodgeBtn.Enabled   = false;
                        user.fightWindow.fxDefenceBtn.Enabled = false;
                        user.fightWindow.fxEscapeBtn.Enabled  = false;
                        user.fightWindow.fxLootNPCBtn.Visible = true;
                    }
                }
                else
                {
                    actor.Health -= NPC.GetSkills()[0].value * 5;
                    NPC.EditStamina(-50 - NPC.GetSkills()[2].value * -4);

                    user.fightWindow.fxResultOfActionText.AppendText(NPC.GetName() + " нанёс удар " + actor.name + ".\n" +
                                                                     actor.name + " получен урон: " + NPC.GetSkills()[0].value * 5 + ".\n\n");
                }
            }
            else
            {
                if (actionFromActor)
                {
                    user.fightWindow.fxResultOfActionText.AppendText(actor.name + " попытался нанести удар по " + NPC.GetName()
                                                                     + " но промахнулся.\n\n");

                    actor.Stamina -= (50 - actor.skills[2].value * 4);
                }
                else
                {
                    user.fightWindow.fxResultOfActionText.AppendText(NPC.GetName() + " попытался нанести удар по " + actor.name
                                                                     + " но промахнулся.\n\n");
                    NPC.EditStamina(-50 - NPC.GetSkills()[2].value * -4);
                }
            }
            user.fightWindow.fxResultOfActionText.ScrollToCaret();

            TimeFlow.AddMinutes(1);
        }
示例#3
0
        public static void UpdateNPC()
        {
            user.fightWindow.fxNPCIconPB.Image      = NPC.GetIcon();
            user.fightWindow.fxNPCNameLabel.Text    = NPC.GetName();
            user.fightWindow.fxNPCGroupLabel.Text   = NPC.GetGroup();
            user.fightWindow.fxNPCHealthPB.Value    = NPC.GetHealth();
            user.fightWindow.fxNPCHealthLabel.Text  = NPC.GetHealth().ToString();
            user.fightWindow.fxNPCStaminaPB.Value   = NPC.GetStamina();
            user.fightWindow.fxNPCStaminaLabel.Text = NPC.GetStamina().ToString();

            user.fightWindow.fxNPCParamsDGV.Rows.Clear();
            for (int i = 0; i < NPC.GetSkills().Count; i++)
            {
                user.fightWindow.fxNPCParamsDGV.Rows.Add();

                user.fightWindow.fxNPCParamsDGV.Rows[i].Cells[0].Value = NPC.GetSkills()[i].name;
                user.fightWindow.fxNPCParamsDGV.Rows[i].Cells[1].Value = NPC.GetSkills()[i].value;
            }
        }
示例#4
0
    public void PrepareUseSkill(GameCmd.stPrepareUseSkillSkillUserCmd_S cmd)
    {
        EntityType type      = EntitySystem.EntityHelper.GetEntityEtype(cmd.usertype);
        ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, type);

        if (skillPart == null)
        {
            Engine.Utility.Log.Error("获取技能部件失败!" + cmd.userid + " type is " + Enum.GetName(typeof(EntityType), type));
            return;
        }
        if (cmd.level == 0)
        {
            cmd.level = 1;
        }
        SkillDatabase database = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(cmd.skillid, (int)cmd.level);

        if (database == null)
        {
            Engine.Utility.Log.Error(" skill database is null skillid is " + cmd.skillid.ToString() + " level is " + cmd.level.ToString());
            return;
        }
        skillPart.OnPrepareUseSkill(cmd);


        if (type == EntityType.EntityType_Player)
        {
            uint time = (database.dwReadTime);
            if (time > 0)
            {
                TimerAxis.Instance().SetTimer(m_uReadSliderTimerID, time, this, 1);
            }
        }
        else if (type == EntityType.EntityType_NPC)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();
            if (es == null)
            {
                Engine.Utility.Log.Error("GetEntitySystem failed!");
                return;
            }

            INPC npc = es.FindEntity <INPC>(cmd.userid);
            if (npc != null)
            {
                int masterID = npc.GetProp((int)NPCProp.Masterid);
                if (masterID == MainPlayerHelper.GetPlayerID())
                {
                    SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)cmd.skillid);
                    if (db != null)
                    {
                        if (db.petType == 1 || db.petType == 2)
                        {
                            Client.stSkillCDChange st = new Client.stSkillCDChange();
                            st.skillid = (uint)cmd.skillid;
                            st.cd      = -1;
                            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLCD_BEGIN, st);
                            TipsManager.Instance.ShowTips(npc.GetName() + CommonData.GetLocalString("使用") + db.strName);
                        }
                    }
                }
            }
        }
    }