Exemple #1
0
    // 创建角色属性表aa
    protected Hashtable CreateBasePropertyTable(CliProto.SC_SELF_BASE_PRO kBaseProperty)
    {
        Hashtable kTable = new Hashtable();

        kTable["HurtOtherModify"] = 0;
        kTable["PhysicsModify"]   = 0;
        kTable["IceModify"]       = 0;
        kTable["FireModify"]      = 0;
        kTable["PoisonModify"]    = 0;
        kTable["ThunderModify"]   = 0;
        kTable["StayModify"]      = 0;
        kTable["HoldModify"]      = 0;
        kTable["StunModify"]      = 0;
        kTable["BeHurtModify"]    = 0;

        MemberInfo[] kBasePropertyInfo = kBaseProperty.GetDesc();
        for (int i = 0; i < kBasePropertyInfo.Length; ++i)
        {
            object val = kBaseProperty.GetMemberValue(i);
            kTable[kBasePropertyInfo[i].name] = val;
        }

        // 角色名转换编码aa
        kTable["Name"] = System.Text.Encoding.UTF8.GetString((byte[])kTable["Name"]).Trim('\0');

        return(kTable);
    }
Exemple #2
0
    private static void msg_SCID_SELF_BASE_PRO(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_SELF_BASE_PRO refMSG = (CliProto.SC_SELF_BASE_PRO)msg;

        if (refMSG != null)
        {
            refMSG.m_HP = refMSG.m_MaxHP;
            refMSG.m_SP = refMSG.m_MaxSP;
            Hashtable charProps = new Hashtable();
            charProps["HurtOtherModify"] = 0;
            charProps["PhysicsModify"]   = 0;
            charProps["IceModify"]       = 0;
            charProps["FireModify"]      = 0;
            charProps["PoisonModify"]    = 0;
            charProps["ThunderModify"]   = 0;
            charProps["StayModify"]      = 0;
            charProps["HoldModify"]      = 0;
            charProps["StunModify"]      = 0;
            charProps["BeHurtModify"]    = 0;

            MemberInfo[] propInfo = refMSG.GetDesc();
            for (int i = 0; i < propInfo.Length; ++i)
            {
                object val = refMSG.GetMemberValue(i);
                if (propInfo[i].name == "RoleIndex")
                {
                    int value = (int)val;
                    value += 100000;
                    charProps[propInfo[i].name] = value;
                }
                else
                {
                    charProps[propInfo[i].name] = val;
                }
            }
            //charProps["NonCash"] = uint.MinValue;
            Hashtable compareTable = sdGlobalDatabase.Instance.globalData["MainCharBaseProp"] as Hashtable;
            if (compareTable != null)
            {
                if (compareTable["Level"].ToString() != charProps["Level"].ToString())
                {
                    if (sdUICharacter.Instance.lvupChange.Contains("Level"))
                    {
                        sdUICharacter.Instance.lvupChange["Level"] = compareTable["Level"].ToString();
                    }
                    else
                    {
                        sdUICharacter.Instance.lvupChange.Add("Level", compareTable["Level"].ToString());
                    }

                    int change = 0;

                    int attdmg     = int.Parse(charProps["AtkDmgMin"].ToString()) + int.Parse(charProps["AtkDmgMax"].ToString());
                    int attcompare = int.Parse(compareTable["AtkDmgMin"].ToString()) + int.Parse(compareTable["AtkDmgMax"].ToString());
                    change = (attdmg - attcompare) / 2;
                    if (sdUICharacter.Instance.lvupChange.Contains("AttDmg"))
                    {
                        sdUICharacter.Instance.lvupChange["AttDmg"] = change;
                    }
                    else
                    {
                        sdUICharacter.Instance.lvupChange.Add("AttDmg", change);
                    }

                    int def        = int.Parse(charProps["Def"].ToString());
                    int defcompare = int.Parse(compareTable["Def"].ToString());
                    change = def - defcompare;
                    if (sdUICharacter.Instance.lvupChange.Contains("Def"))
                    {
                        sdUICharacter.Instance.lvupChange["Def"] = change;
                    }
                    else
                    {
                        sdUICharacter.Instance.lvupChange.Add("Def", change);
                    }

                    int hp        = int.Parse(charProps["HP"].ToString());
                    int hpcompare = int.Parse(compareTable["HP"].ToString());
                    change = hp - hpcompare;
                    if (sdUICharacter.Instance.lvupChange.Contains("HP"))
                    {
                        sdUICharacter.Instance.lvupChange["HP"] = change;
                    }
                    else
                    {
                        sdUICharacter.Instance.lvupChange.Add("HP", change);
                    }

                    string main = "";
                    int    job  = int.Parse(charProps["BaseJob"].ToString());
                    switch (job)
                    {
                    case (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior:
                    {
                        main = "Str";
                        break;
                    }

                    case (int)HeaderProto.ERoleJob.ROLE_JOB_Magic:
                    {
                        main = "Int";
                        break;
                    }

                    case (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue:
                    {
                        main = "Dex";
                        break;
                    }

                    case (int)HeaderProto.ERoleJob.ROLE_JOB_Minister:
                    {
                        main = "Fai";
                        break;
                    }
                    }
                    int mainValue   = int.Parse(charProps[main].ToString());
                    int maincompare = int.Parse(compareTable[main].ToString());
                    change = mainValue - maincompare;

                    sdUICharacter.Instance.lvupChange[main] = change;
                }
            }

            sdGlobalDatabase.Instance.globalData["MainCharBaseProp"] = charProps;

            sdGameLevel level = sdGameLevel.instance;
            if (level != null)
            {
                if (level.mainChar != null)
                {
                    Hashtable prop = sdConfDataMgr.CloneHashTable(charProps);
                    prop["HP"] = level.mainChar["HP"];
                    prop["SP"] = level.mainChar["SP"];
                    level.mainChar.Property = prop;
                    level.mainChar.RefreshProp();
                }
            }
        }

        if (sdGameLevel.instance != null && sdGameLevel.instance.mainChar != null)
        {
            sdGameLevel.instance.mainChar.AddSuitBuff();
            sdGameLevel.instance.mainChar.RefreshProp();
        }

        if (sdUICharacter.Instance.playerScore > 0)
        {
            int score = sdConfDataMgr.Instance().PlayerScore();
            if (score > sdUICharacter.Instance.playerScore)
            {
                sdUICharacter.Instance.ShowScorePanel(sdUICharacter.Instance.playerScore, score);
                sdUICharacter.Instance.playerScore = score;
            }
        }
    }