| | |
| | |
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using LitJson;
|
| | |
|
| | |
| | | {
|
| | |
|
| | | public Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction> bossActions = new Dictionary<int, HA513_tagMCFamilyActionInfo.tagMCFamilyAction>();
|
| | | // 玩家伤害排行
|
| | | public List<HA513_tagMCFamilyActionInfo.tagMCFamilyAction> playerBossHurtRank = new List<HA513_tagMCFamilyActionInfo.tagMCFamilyAction>();
|
| | | //时间戳:讨伐数据
|
| | | public Dictionary<int, TaofaAtkData> taofaAtkData = new Dictionary<int, TaofaAtkData>();
|
| | | //玩家ID:玩家数据 (退出公会的玩家)
|
| | | public Dictionary<int, MemberData> taofaPlayerData = new Dictionary<int, MemberData>();
|
| | | public event Action BossHurtEvent;
|
| | |
|
| | |
|
| | | //自己的数据
|
| | | public byte m_BuZhenState; // 是否已布阵
|
| | | public ushort m_AtkCount; // 已斩杀次数,用于计算剩余次数=免费次数+道具增加次数-已斩杀次数
|
| | | public ushort m_ItemAddCount; // 道具增加斩杀次数
|
| | | public ushort m_Anger; // 当前怒气值
|
| | | public ushort m_BoxUnGetCount; // 当前未领取的宝箱数,即可领取的
|
| | | public long m_BoxHurt; // 今日伤害
|
| | | public long m_BoxHurtHis; // 历史伤害
|
| | |
|
| | | //配置
|
| | | public int initSuperHitRate;
|
| | |
| | | public int[] bxCumulativeDamageList;
|
| | | public int bxDailyMax; //个人每日产出上限
|
| | | public int bxDailyAwardMax; //个人每日领取奖励上限
|
| | | public int addAtkCntItemID = 17; //增加讨伐次数道具ID
|
| | | public int bossSkinID = 7100300;
|
| | |
|
| | |
|
| | | void ParseConfig()
|
| | | {
|
| | | // 数值1:初始暴击率万分率,功能独立的暴击率,与角色暴击无关
|
| | | // 数值3:布阵最大层级,暂固定每人1次,1次1层
|
| | | // 数值3:布阵最大层级
|
| | | var config = FuncConfigConfig.Get("FamilyTaofaBuzhen");
|
| | | initSuperHitRate = int.Parse(config.Numerical1);
|
| | | bzAddAttrs = ConfigParse.GetMultipleStr<int>(config.Numerical2);
|
| | |
| | |
|
| | | public override void Init()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEventOnRelogin;
|
| | | GuildManager.Instance.EnterOrQuitGuildEvent += EnterOrQuitGuildEvent;
|
| | | ParseConfig();
|
| | | }
|
| | | public override void Release()
|
| | | {
|
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitializeEventOnRelogin;
|
| | | GuildManager.Instance.EnterOrQuitGuildEvent -= EnterOrQuitGuildEvent;
|
| | | }
|
| | |
|
| | | void OnBeforePlayerDataInitializeEventOnRelogin()
|
| | | {
|
| | | bossActions.Clear();
|
| | | playerBossHurtRank.Clear();
|
| | | m_BuZhenState = 0;
|
| | | m_AtkCount = 0;
|
| | | m_ItemAddCount = 0;
|
| | | m_Anger = 0;
|
| | | m_BoxUnGetCount = 0;
|
| | | m_BoxHurt = 0;
|
| | | m_BoxHurtHis = 0;
|
| | | taofaAtkData.Clear();
|
| | | taofaPlayerData.Clear();
|
| | | }
|
| | |
|
| | |
|
| | | void EnterOrQuitGuildEvent(bool isEnter)
|
| | | {
|
| | | if (!isEnter)
|
| | | {
|
| | | bossActions.Clear();
|
| | | playerBossHurtRank.Clear();
|
| | | taofaAtkData.Clear();
|
| | | taofaPlayerData.Clear();
|
| | | }
|
| | | UpdateRedpoint();
|
| | | }
|
| | |
|
| | |
|
| | | //// 操作:0-斩杀攻击;1-布阵
|
| | | public void TaofaBoss(int opType)
|
| | |
| | | GameNetSystem.Instance.SendInfo(pack);
|
| | | }
|
| | |
|
| | | public void UpdataMyBossData(HA503_tagSCFamilyTaofaInfo netPack)
|
| | | {
|
| | | m_BuZhenState = netPack.BuZhenState;
|
| | | m_AtkCount = netPack.AtkCount;
|
| | | m_ItemAddCount = netPack.ItemAddCount;
|
| | | m_Anger = netPack.Anger;
|
| | | m_BoxUnGetCount = netPack.BoxUnGetCount;
|
| | | m_BoxHurt = netPack.BoxHurt + netPack.BoxHurtEx * Constants.ExpPointValue;
|
| | | m_BoxHurtHis = netPack.BoxHurtHis + netPack.BoxHurtHisEx * Constants.ExpPointValue;
|
| | |
|
| | | UpdateRedpoint();
|
| | | BossHurtEvent?.Invoke();
|
| | | }
|
| | |
|
| | |
|
| | | public int GetHasAtkCnt()
|
| | | {
|
| | | return freeAtkCount + m_ItemAddCount - m_AtkCount;
|
| | | }
|
| | |
|
| | | // 【公会行为】
|
| | | // 增加行为类型18 - 公会讨伐相关数据
|
| | |
| | | // atkList - 讨伐记录列表,可用于表现成员头像攻击: atkTime - 攻击时间戳, atkType - 攻击类型(0-普通攻击, 1-怒气攻击)
|
| | | // info - 不一定有该key,仅退出的成员才有,用于更新退出成员相关基础信息,如名字、头像等,还在公会里的成员通过 // A5 20 玩家家族信息 #tagMCRoleFamilyInfo 取成员信息
|
| | | // "info":{"LV":106,"Job":1,"Name":"主公3016219","FacePic":0,"FightPower":1831995,"RealmLV":12,"ServerID":86,"TitleID":0,"Face":0},
|
| | | |
| | | // boss讨伐的全局数据
|
| | | public HA513_tagMCFamilyActionInfo.tagMCFamilyAction GetGuildBossAction()
|
| | | {
|
| | |
|
| | | if (bossActions.ContainsKey(1))
|
| | | {
|
| | | return bossActions[1];
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | //判断是否新的公会数据
|
| | | if (vNetData.FamilyActionList.Length == 1 && vNetData.FamilyActionList[0].Value1 == 1)
|
| | | {
|
| | | if (bossActions.ContainsKey(1) && bossActions[1].Time != vNetData.FamilyActionList[0].Time)
|
| | | {
|
| | | bossActions.Clear();
|
| | | playerBossHurtRank.Clear();
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = 0; i < vNetData.Count; i++)
|
| | | {
|
| | | bossActions[(int)vNetData.FamilyActionList[i].Value1] = vNetData.FamilyActionList[i];
|
| | | }
|
| | |
|
| | |
|
| | | SortPlayerHurt();
|
| | | RefreshAtkList();
|
| | | BossHurtEvent?.Invoke();
|
| | | return true;
|
| | | }
|
| | |
|
| | | void SortPlayerHurt()
|
| | | {
|
| | | playerBossHurtRank.Clear();
|
| | | foreach (var item in bossActions)
|
| | | {
|
| | | if (item.Value.Value1 != 1)
|
| | | {
|
| | | if (item.Value.Value4 == 0 && item.Value.Value5 == 0)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | playerBossHurtRank.Add(item.Value);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | playerBossHurtRank.Sort((a, b) => (b.Value4 + b.Value5 * Constants.ExpPointValue).CompareTo(a.Value4 + a.Value5 * Constants.ExpPointValue));
|
| | | }
|
| | |
|
| | | //解析攻击记录 和 玩家信息(退出公会的)
|
| | | void RefreshAtkList()
|
| | | {
|
| | | //{"atkList":[[atkTime, 本次贡献箱子数, 本次总伤害, atkType], ...], "info":{k:v, ...}}
|
| | | //"info":{"LV":106,"Job":1,"Name":"主公3016219","FacePic":0,"FightPower":1831995,"RealmLV":12,"ServerID":86,"TitleID":0,"Face":0},
|
| | | taofaAtkData.Clear();
|
| | | taofaPlayerData.Clear();
|
| | | foreach (var item in playerBossHurtRank)
|
| | | {
|
| | | JsonData jsonData = JsonMapper.ToObject(item.UseData);
|
| | | if (!jsonData.ContainsKey("atkList"))
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var arr = JsonMapper.ToObject<long[][]>(jsonData["atkList"].ToJson());
|
| | | taofaAtkData[(int)arr[0][0]] = new TaofaAtkData()
|
| | | {
|
| | | playerID = (int)item.Value1,
|
| | | atkType = (int)arr[0][3],
|
| | | hurt = arr[0][2],
|
| | |
|
| | | };
|
| | |
|
| | | if (jsonData.ContainsKey("info"))
|
| | | {
|
| | | taofaPlayerData[(int)item.Value1] = JsonMapper.ToObject<MemberData>(jsonData["info"].ToJson());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // 获取我的排名
|
| | | public int GetMyRank()
|
| | | {
|
| | | int rank = 0;
|
| | | for (int i = 0; i < playerBossHurtRank.Count; i++)
|
| | | {
|
| | | if (playerBossHurtRank[i].Value1 == PlayerDatas.Instance.baseData.PlayerID)
|
| | | {
|
| | | rank = i + 1;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return rank;
|
| | | }
|
| | |
|
| | | //获取成员外观数据 头像名字等
|
| | | public MemberData GetMemberData(int playerId)
|
| | | {
|
| | | var playerInfo = PlayerDatas.Instance.fairyData.GetMember(playerId);
|
| | | if (playerInfo == null)
|
| | | {
|
| | | return taofaPlayerData.ContainsKey(playerId) ? taofaPlayerData[playerId] : null;
|
| | | }
|
| | |
|
| | | return new MemberData()
|
| | | {
|
| | | LV = playerInfo.LV,
|
| | | Job = playerInfo.Job,
|
| | | Name = playerInfo.Name,
|
| | | FacePic = playerInfo.FacePic,
|
| | | FightPower = (ulong)playerInfo.FightPower,
|
| | | RealmLV = playerInfo.RealmLV,
|
| | | ServerID = playerInfo.ServerID,
|
| | | TitleID = playerInfo.TitleID,
|
| | | Face = playerInfo.Face
|
| | |
|
| | | };
|
| | |
|
| | | }
|
| | |
|
| | | #region 红点
|
| | | Redpoint redPoint = new Redpoint(MainRedDot.MainGuildRedpoint, MainRedDot.bossTaofaRedpointID);
|
| | |
|
| | | void UpdateRedpoint()
|
| | | {
|
| | | redPoint.state = RedPointState.None;
|
| | |
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Guild))
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (PlayerDatas.Instance.fairyData.fairy == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (m_BuZhenState == 0)
|
| | | {
|
| | | redPoint.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | |
|
| | | if (GetHasAtkCnt() > 0)
|
| | | {
|
| | | redPoint.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | |
|
| | | if (m_BoxUnGetCount > 0)
|
| | | {
|
| | | redPoint.state = RedPointState.Simple;
|
| | | return;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | |
|
| | | public class PlayerGuildBossAtkInfo
|
| | | public class TaofaAtkData
|
| | | {
|
| | | public int playerID;
|
| | | public int atkTime;
|
| | | public int bzTime;
|
| | | public int atkCount;
|
| | | public long totalHurtValue;
|
| | | public int boxCnt;
|
| | |
|
| | | public int atkType;
|
| | | public long hurt;
|
| | | }
|
| | |
|
| | | public class MemberData
|
| | | {
|
| | | public int LV;
|
| | | public int Job;
|
| | | public string Name;
|
| | | public int FacePic;
|
| | | public ulong FightPower;
|
| | | public int RealmLV;
|
| | | public int ServerID;
|
| | | public int TitleID;
|
| | | public int Face;
|
| | |
|
| | | }
|