Beispiel #1
0
 public static RoleBornConfig GetRoleBornCfg(int sex, int prof)
 {
     foreach (KeyValuePair <int, RoleBornConfig> roleBorn in ConfigMgr.Inst().RoleBorn.configs)
     {
         RoleBornConfig config = roleBorn.Value;
         if (config.professionID == prof && config.gender == sex)
         {
             return(config);
         }
     }
     return(null);
 }
Beispiel #2
0
        public static UserRole CreateRole(int userId, int roleId, string name, int sex, int prof)
        {
            RoleBornConfig bornConfig = GetRoleBornCfg(sex, prof);

            if (bornConfig == null)
            {
                return(null);
            }

            UserRole role = new UserRole();

            role.RoleId      = roleId;
            role.UserId      = userId;
            role.Name        = name;
            role.Sex         = sex;
            role.Prof        = prof;
            role.Level       = bornConfig.bornLevel;
            role.Exp         = 0;
            role.Hp          = 100;
            role.FightPower  = 1;
            role.Gold        = bornConfig.gold;
            role.BindGold    = bornConfig.bindGold;
            role.Diamond     = bornConfig.diamond;
            role.BindDiamond = bornConfig.bindDiamond;
            role.Race        = bornConfig.race;

            role.EnterSceneId = bornConfig.mapID;
            role.EnterMapId   = bornConfig.mapID;

            role.EnterPosX = bornConfig.mapX / 1000.0f;
            role.EnterPosY = bornConfig.mapY / 1000.0f;
            role.EnterPosZ = bornConfig.mapZ / 1000.0f;

            role.LastSceneId = bornConfig.mapID;
            role.LastMapId   = bornConfig.mapID;

            role.LastPosX = bornConfig.mapX / 1000.0f;
            role.LastPosY = bornConfig.mapY / 1000.0f;
            role.LastPosZ = bornConfig.mapZ / 1000.0f;

            RoleExpConfig expConfig = GetRoleExpCfg(bornConfig.bornLevel);

            if (expConfig == null)
            {
                return(null);
            }

            role.Stamina = expConfig.stamina;

            return(role);
        }
Beispiel #3
0
    public void Load()
    {
        CVSReader reader = new CVSReader();

        reader.LoadText("Data/Config/Role_born.txt", 1);
        int rows = reader.GetRowCount();

        for (int r = 0; r < rows; ++r)
        {
            string[]       row = reader.GetRow(r);
            RoleBornConfig ac  = ConfigProcess(row) as RoleBornConfig;
            configs.Add(ac.bornID, ac);
        }
    }
Beispiel #4
0
    public object ConfigProcess(string[] row)
    {
        if (row.Length < 106)
        {
            return(null);
        }
        RowHelper      rh  = new RowHelper(row);
        RoleBornConfig rec = new RoleBornConfig();

        rec.bornID = Utility.ToInt(rh.Read());              //主键ID

        rec.professionID = Utility.ToInt(rh.Read());        //职业ID

        rec.professionName = rh.Read();                     //职业名称

        rec.placement = rh.Read();                          //职业介绍

        rec.race = Utility.ToInt(rh.Read());                //种族

        rec.gender = Utility.ToInt(rh.Read());              //性别

        rec.bornLevel = Utility.ToInt(rh.Read());           //出生等级

        rec.bornTitle = Utility.ToInt(rh.Read());           //携带称号

        rec.diamond = Utility.ToInt(rh.Read());             //携带钻石

        rec.bindDiamond = Utility.ToInt(rh.Read());         //携带绑定钻石

        rec.gold = Utility.ToInt(rh.Read());                //携带金币

        rec.bindGold = Utility.ToInt(rh.Read());            //携带绑定金币

        rec.mapID = Utility.ToInt(rh.Read());               //出生地图ID

        rec.mapX = Utility.ToInt(rh.Read());                //出生地的X点

        rec.mapY = Utility.ToInt(rh.Read());                //出生地的Y点

        rec.mapZ = Utility.ToInt(rh.Read());                //出生地的Z点

        rec.birthFace = Utility.ToInt(rh.Read());           //出生朝向

        rec.icons = rh.Read();                              //头像图标

        rec.loginAvata = rh.Read();                         //创角界面模型

        rec.weaponAvata = rh.Read();                        //出生时武器模型

        rec.roleAvata = rh.Read();                          //出生时模型

        rec.carryWeapons = Utility.ToInt(rh.Read());        //装备武器

        rec.carryArmor = Utility.ToInt(rh.Read());          //装备衣服

        rec.carryCloak = Utility.ToInt(rh.Read());          //装备披风

        rec.carryShoes = Utility.ToInt(rh.Read());          //装备鞋子

        rec.carryNecklace = Utility.ToInt(rh.Read());       //装备项链

        rec.carryAmulet = Utility.ToInt(rh.Read());         //装备护符

        rec.carryBracer1 = Utility.ToInt(rh.Read());        //装备护腕

        rec.carryBracer2 = Utility.ToInt(rh.Read());        //装备护腕

        rec.carryRing1 = Utility.ToInt(rh.Read());          //装备戒指

        rec.carryRing2 = Utility.ToInt(rh.Read());          //装备戒指

        rec.carryFashionWeapons = Utility.ToInt(rh.Read()); //装备时装(武器)

        rec.carryFashionArmor = Utility.ToInt(rh.Read());   //装备时装(衣服)

        rec.carryWings = Utility.ToInt(rh.Read());          //装备翅膀

        rec.actBuff = new int[4];

        rec.actBuff[0] = Utility.ToInt(rh.Read());               //生成buff

        rec.actBuff[1] = Utility.ToInt(rh.Read());               //生成buff

        rec.actBuff[2] = Utility.ToInt(rh.Read());               //生成buff

        rec.actBuff[3] = Utility.ToInt(rh.Read());               //生成buff

        rec.actSkill = new int[6];

        rec.actSkill[0] = Utility.ToInt(rh.Read());              //生成技能

        rec.actSkill[1] = Utility.ToInt(rh.Read());              //生成技能

        rec.actSkill[2] = Utility.ToInt(rh.Read());              //生成技能

        rec.actSkill[3] = Utility.ToInt(rh.Read());              //生成技能

        rec.actSkill[4] = Utility.ToInt(rh.Read());              //生成技能

        rec.actSkill[5] = Utility.ToInt(rh.Read());              //生成技能

        rec.item = new RoleBornItemConfig[31];

        for (int i = 0; i < 31; i++)
        {
            rec.item[i] = new RoleBornItemConfig();
        }

        rec.item[0].name = Utility.ToInt(rh.Read());             //名称

        rec.item[0].num = Utility.ToInt(rh.Read());              //数量

        rec.item[1].name = Utility.ToInt(rh.Read());             //名称

        rec.item[1].num = Utility.ToInt(rh.Read());              //数量

        rec.item[2].name = Utility.ToInt(rh.Read());             //名称

        rec.item[2].num = Utility.ToInt(rh.Read());              //数量

        rec.item[3].name = Utility.ToInt(rh.Read());             //名称

        rec.item[3].num = Utility.ToInt(rh.Read());              //数量

        rec.item[4].name = Utility.ToInt(rh.Read());             //名称

        rec.item[4].num = Utility.ToInt(rh.Read());              //数量

        rec.item[5].name = Utility.ToInt(rh.Read());             //名称

        rec.item[5].num = Utility.ToInt(rh.Read());              //数量

        rec.item[6].name = Utility.ToInt(rh.Read());             //名称

        rec.item[6].num = Utility.ToInt(rh.Read());              //数量

        rec.item[7].name = Utility.ToInt(rh.Read());             //名称

        rec.item[7].num = Utility.ToInt(rh.Read());              //数量

        rec.item[8].name = Utility.ToInt(rh.Read());             //名称

        rec.item[8].num = Utility.ToInt(rh.Read());              //数量

        rec.item[9].name = Utility.ToInt(rh.Read());             //名称

        rec.item[9].num = Utility.ToInt(rh.Read());              //数量

        rec.item[10].name = Utility.ToInt(rh.Read());            //名称

        rec.item[10].num = Utility.ToInt(rh.Read());             //数量

        rec.item[11].name = Utility.ToInt(rh.Read());            //名称

        rec.item[11].num = Utility.ToInt(rh.Read());             //数量

        rec.item[12].name = Utility.ToInt(rh.Read());            //名称

        rec.item[12].num = Utility.ToInt(rh.Read());             //数量

        rec.item[13].name = Utility.ToInt(rh.Read());            //名称

        rec.item[13].num = Utility.ToInt(rh.Read());             //数量

        rec.item[14].name = Utility.ToInt(rh.Read());            //名称

        rec.item[14].num = Utility.ToInt(rh.Read());             //数量

        rec.item[15].name = Utility.ToInt(rh.Read());            //名称

        rec.item[15].num = Utility.ToInt(rh.Read());             //数量

        rec.item[16].name = Utility.ToInt(rh.Read());            //名称

        rec.item[16].num = Utility.ToInt(rh.Read());             //数量

        rec.item[17].name = Utility.ToInt(rh.Read());            //名称

        rec.item[17].num = Utility.ToInt(rh.Read());             //数量

        rec.item[18].name = Utility.ToInt(rh.Read());            //名称

        rec.item[18].num = Utility.ToInt(rh.Read());             //数量

        rec.item[19].name = Utility.ToInt(rh.Read());            //名称

        rec.item[19].num = Utility.ToInt(rh.Read());             //数量

        rec.item[20].name = Utility.ToInt(rh.Read());            //名称

        rec.item[20].num = Utility.ToInt(rh.Read());             //数量

        rec.item[21].name = Utility.ToInt(rh.Read());            //名称

        rec.item[21].num = Utility.ToInt(rh.Read());             //数量

        rec.item[22].name = Utility.ToInt(rh.Read());            //名称

        rec.item[22].num = Utility.ToInt(rh.Read());             //数量

        rec.item[23].name = Utility.ToInt(rh.Read());            //名称

        rec.item[23].num = Utility.ToInt(rh.Read());             //数量

        rec.item[24].name = Utility.ToInt(rh.Read());            //名称

        rec.item[24].num = Utility.ToInt(rh.Read());             //数量

        rec.item[25].name = Utility.ToInt(rh.Read());            //名称

        rec.item[25].num = Utility.ToInt(rh.Read());             //数量

        rec.item[26].name = Utility.ToInt(rh.Read());            //名称

        rec.item[26].num = Utility.ToInt(rh.Read());             //数量

        rec.item[27].name = Utility.ToInt(rh.Read());            //名称

        rec.item[27].num = Utility.ToInt(rh.Read());             //数量

        rec.item[28].name = Utility.ToInt(rh.Read());            //名称

        rec.item[28].num = Utility.ToInt(rh.Read());             //数量

        rec.item[29].name = Utility.ToInt(rh.Read());            //名称

        rec.item[29].num = Utility.ToInt(rh.Read());             //数量

        rec.item[30].name = Utility.ToInt(rh.Read());            //名称

        rec.item[30].num = Utility.ToInt(rh.Read());             //数量


        return(rec);
    }