You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
244 lines
6.8 KiB
244 lines
6.8 KiB
using System;
|
|
using ProtoCSStruct;
|
|
|
|
|
|
|
|
namespace MysqlHandling
|
|
{
|
|
class Role
|
|
{
|
|
public DBRoleBase m_RoleBase = new DBRoleBase();
|
|
public DBRoleData m_RoleData = new DBRoleData();
|
|
public DBRoleUnimportanceData m_UnimportanceData = new DBRoleUnimportanceData();
|
|
|
|
|
|
public int m_bagCount;
|
|
public int m_heroCount;
|
|
public int m_equipmentCount;
|
|
|
|
|
|
public Role(long uid, int bagCount, int heroCount, int equipmentCount)
|
|
{
|
|
m_bagCount = bagCount;
|
|
m_heroCount = heroCount;
|
|
m_equipmentCount = equipmentCount;
|
|
|
|
MakeRoleBase(uid);
|
|
MakeRoleData();
|
|
MakeUnimportanceData(heroCount, bagCount);
|
|
}
|
|
|
|
|
|
public void MakeRoleData()
|
|
{
|
|
MakeRoleBagData();
|
|
|
|
MakeRoleHerosData();
|
|
|
|
MakeRoleEquipmentData();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 构建角色数据
|
|
/// DBRoleData roleData
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public void MakeRoleBagData()
|
|
{
|
|
// 构建物品背包数据
|
|
MakeBagIterms();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 构建英雄背包数据
|
|
/// </summary>
|
|
public void MakeRoleHerosData()
|
|
{
|
|
MakeDBHeroList();
|
|
|
|
MakeHeroLineUp();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 构建英雄装备数据
|
|
/// </summary>
|
|
public void MakeRoleEquipmentData()
|
|
{
|
|
MakeEquipmentList();
|
|
}
|
|
|
|
|
|
|
|
public void MakeEquipmentList()
|
|
{
|
|
// 装备数量是随机值
|
|
int randValue = m_equipmentCount;
|
|
|
|
for (int i = 0; i < m_equipmentCount; ++i)
|
|
{
|
|
randValue++;
|
|
var item = new DBEquipment
|
|
{
|
|
DescId = randValue,
|
|
Exp = randValue,
|
|
Level = randValue,
|
|
SerialNum = randValue,
|
|
OwnerHero = randValue
|
|
};
|
|
|
|
m_RoleData.EquipmentData.List.Add(ref item);
|
|
}
|
|
}
|
|
|
|
|
|
public void MakeHeroLineUp()
|
|
{
|
|
int randValue = m_heroCount;
|
|
|
|
// 上阵阵容
|
|
for (int i = 0; i < m_RoleData.LineupData.List.GetMaxCount(); ++i)
|
|
{
|
|
randValue++;
|
|
|
|
var lineupOne = new DBLineupOne
|
|
{
|
|
CommanderSerialNum = randValue, MainlandScene = i, SubType = i, Type = i
|
|
};
|
|
|
|
for (int j = 0; j < 5; j++)
|
|
{
|
|
IDValue32 item = new IDValue32 {Id = randValue, Value = randValue };
|
|
lineupOne.HeroList.Add(ref item);
|
|
}
|
|
|
|
m_RoleData.LineupData.List.Add(ref lineupOne);
|
|
}
|
|
|
|
// 编队
|
|
string s = "attack team ";
|
|
for (int i = 0; i < m_RoleData.LineupData.FormattionList.GetMaxCount(); ++i)
|
|
{
|
|
randValue++;
|
|
|
|
var formOne = new DBFormationOne
|
|
{
|
|
CommanderSerialNum = randValue,
|
|
Id = randValue,
|
|
};
|
|
|
|
formOne.Name.SetString(s + i);
|
|
|
|
for (int j = 0; j < 5; j++)
|
|
{
|
|
IDValue32 item = new IDValue32 { Id = randValue, Value = randValue };
|
|
formOne.HeroList.Add(ref item);
|
|
}
|
|
|
|
m_RoleData.LineupData.FormattionList.Add(ref formOne);
|
|
}
|
|
}
|
|
|
|
|
|
public void MakeDBHeroList()
|
|
{
|
|
// 英雄数量是随机值
|
|
int randValue = m_heroCount;
|
|
|
|
for (int i = 0; i < m_heroCount; i++)
|
|
{
|
|
randValue++;
|
|
DBHero item = new DBHero
|
|
{
|
|
SerialNum = randValue,
|
|
DescId = randValue,
|
|
Level = randValue,
|
|
Star = randValue,
|
|
Exp = randValue,
|
|
HeroTalent = randValue,
|
|
TalentSteps = randValue,
|
|
IsJoinBattle = randValue,
|
|
HeroPower = randValue,
|
|
RaceIconLevel = randValue,
|
|
WeaponId = randValue,
|
|
WeaponLevel = randValue,
|
|
PowerChangeSeq = randValue,
|
|
ArtifactSerialNum = randValue,
|
|
TempWeaponLevel = randValue,
|
|
};
|
|
|
|
m_RoleData.HerosData.List.Add(ref item);
|
|
}
|
|
}
|
|
|
|
public void MakeBagIterms()
|
|
{
|
|
int randValue = m_bagCount;
|
|
m_RoleData.Bag.Items.Clear();
|
|
|
|
for (int i = 0; i < m_bagCount; i++)
|
|
{
|
|
randValue++;
|
|
|
|
var item = new DBItemInfo
|
|
{
|
|
Id = (uint) randValue, UniqueID = randValue, Count = randValue, ExpireTime = 0
|
|
};
|
|
m_RoleData.Bag.Items.Add(ref item);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 构建游戏角色基础数据
|
|
/// ref DBRoleBase roleBase,
|
|
/// </summary>
|
|
public void MakeRoleBase(long uid)
|
|
{
|
|
int randValue = m_heroCount;
|
|
m_RoleBase.Uid = uid;
|
|
m_RoleBase.Chip = randValue;
|
|
m_RoleBase.CreateTime = randValue;
|
|
m_RoleBase.Diamond = randValue;
|
|
m_RoleBase.Exp = randValue;
|
|
m_RoleBase.Gender = randValue;
|
|
m_RoleBase.HeroExpPool = randValue;
|
|
m_RoleBase.LastLoginTime = randValue;
|
|
m_RoleBase.Level = randValue;
|
|
m_RoleBase.OnlineTime = randValue;
|
|
m_RoleBase.Power = randValue;
|
|
m_RoleBase.RoleCreateComplete = randValue;
|
|
m_RoleBase.UnionId = randValue;
|
|
m_RoleBase.VipExp = randValue;
|
|
m_RoleBase.VipLevel = randValue;
|
|
m_RoleBase.Nick.SetString($"dbtest_{uid}");
|
|
m_RoleBase.Icon.SetString($"icon_{uid}");
|
|
m_RoleBase.Lang.SetString("test lang");
|
|
}
|
|
|
|
|
|
public void MakeUnimportanceData(int count, int randValue)
|
|
{
|
|
int max = m_UnimportanceData.DBBagChangeRecordList.GetMaxCount();
|
|
for (int i = 0; i < count && i < max; i++)
|
|
{
|
|
randValue++;
|
|
|
|
var item = new DBBagChangeRecord
|
|
{
|
|
Type = randValue,
|
|
ChangeTime = randValue,
|
|
ChangeValue = randValue,
|
|
NewValue = randValue,
|
|
Reason = randValue
|
|
};
|
|
|
|
m_UnimportanceData.DBBagChangeRecordList.Add(ref item);
|
|
}
|
|
|
|
m_UnimportanceData.ClientData.SetString("testmyClientData" + count);
|
|
}
|
|
|
|
}
|
|
}
|
|
|