public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex) { int[] goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferItemType); double result; if (null == goodsIds) { result = 0.0; } else if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { result = 0.0; } else { int goodsID = goodsIds[goodsIndex]; EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { result = 0.0; } else { result = item.ExtProps[(int)extPropIndexe]; } } return(result); }
/// <summary> /// 获取扩展属性接口 /// </summary> /// <param name="bufferItemType"></param> /// <param name="extPropIndexe"></param> /// <returns></returns> public static double GetExtPropByGoodsID(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsID) { EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { return(0.0); } return(item.ExtProps[(int)extPropIndexe]); }
/// <summary> /// 激活战鼓BUFF /// </summary> /// <param name="client"></param> /// <param name="notifyPropsChanged"></param> /// <returns></returns> public bool AddBuffer(GameClient client, BufferItemTypes buffID, double[] newParams, bool notifyPropsChanged) { BufferData bufferData1 = null; if (buffID == BufferItemTypes.MU_ANGELTEMPLEBUFF1) { bufferData1 = Global.GetBufferDataByID(client, (int)BufferItemTypes.MU_ANGELTEMPLEBUFF2); if (bufferData1 != null) { Global.RemoveBufferData(client, (int)BufferItemTypes.MU_ANGELTEMPLEBUFF2); } } else if (buffID == BufferItemTypes.MU_ANGELTEMPLEBUFF2) { bufferData1 = Global.GetBufferDataByID(client, (int)BufferItemTypes.MU_ANGELTEMPLEBUFF1); if (bufferData1 != null) { Global.RemoveBufferData(client, (int)BufferItemTypes.MU_ANGELTEMPLEBUFF1); } } int nIndex = 0; int nOldBufferGoodsIndexID = -1; BufferData bufferData = Global.GetBufferDataByID(client, (int)buffID); if (null != bufferData && !Global.IsBufferDataOver(bufferData)) { nOldBufferGoodsIndexID = (int)bufferData.BufferVal; } if (nOldBufferGoodsIndexID == nIndex) { return(false); } //更新BufferData double[] actionParams = new double[2]; actionParams = newParams; Global.UpdateBufferData(client, buffID, actionParams, 1, notifyPropsChanged); if (notifyPropsChanged) { //通知客户端属性变化 //GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); // 总生命值和魔法值变化通知(同一个地图才需要通知) GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); } return(true); }
/// <summary> /// 获取物品ID /// </summary> /// <param name="bufferItemType"></param> /// <param name="goodsIndex"></param> /// <returns></returns> public static int GetGoodsID(BufferItemTypes bufferItemType, int goodsIndex) { /// 根据BufferID获取缓存的物品ID列表 int[] goodsIds = GetCachingIDsByID((int)bufferItemType); if (null == goodsIds) { return(-1); } if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { return(-1); } int goodsID = goodsIds[goodsIndex]; return(goodsID); }
public static int GetGoodsID(BufferItemTypes bufferItemType, int goodsIndex) { int[] goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferItemType); int result; if (null == goodsIds) { result = -1; } else if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { result = -1; } else { int goodsID = goodsIds[goodsIndex]; result = goodsID; } return(result); }
/// <summary> /// 获取扩展属性接口 /// </summary> /// <param name="bufferItemType"></param> /// <param name="extPropIndexe"></param> /// <returns></returns> public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex) { /// 根据BufferID获取缓存的物品ID列表 int[] goodsIds = GetCachingIDsByID((int)bufferItemType); if (null == goodsIds) { return(0.0); } if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { return(0.0); } int goodsID = goodsIds[goodsIndex]; EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID); if (null == item) { return(0.0); } return(item.ExtProps[(int)extPropIndexe]); }
public bool AddBuffer(GameClient client, BufferItemTypes buffID, double[] newParams, bool notifyPropsChanged) { if (buffID == BufferItemTypes.MU_ANGELTEMPLEBUFF1) { Global.RemoveBufferData(client, 86); } else if (buffID == BufferItemTypes.MU_ANGELTEMPLEBUFF2) { Global.RemoveBufferData(client, 85); } int nIndex = 0; int nOldBufferGoodsIndexID = -1; BufferData bufferData = Global.GetBufferDataByID(client, (int)buffID); if (bufferData != null && !Global.IsBufferDataOver(bufferData, 0L)) { nOldBufferGoodsIndexID = (int)bufferData.BufferVal; } bool result; if (nOldBufferGoodsIndexID == nIndex) { result = false; } else { double[] actionParams = new double[2]; Global.UpdateBufferData(client, buffID, newParams, 1, notifyPropsChanged); if (notifyPropsChanged) { GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); } result = true; } return(result); }
public static void AddTempBufferProp(GameClient client, BufferItemTypes bufferID, int type) { EquipPropItem item = null; do { //判断此地图是否允许使用Buffer if (!Global.CanMapUseBuffer(client.ClientData.MapCode, (int)bufferID)) { break; } BufferData bufferData = Global.GetBufferDataByID(client, (int)bufferID); if (null == bufferData) { break; } if (Global.IsBufferDataOver(bufferData)) { break; } int bufferGoodsId = 0; if (type == 0) { // VIP处理 [4/10/2014 LiaoWei] int goodsIndex = 0; if (bufferID == BufferItemTypes.ZuanHuang) { goodsIndex = client.ClientData.VipLevel; } else { goodsIndex = (int)bufferData.BufferVal; } int[] goodsIds = GetCachingIDsByID((int)bufferID); if (null == goodsIds) { break; } if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { break; } bufferGoodsId = goodsIds[goodsIndex]; } else if (type == 1) { bufferGoodsId = (int)bufferData.BufferVal; } if (bufferGoodsId > 0) { item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsId); } } while (false); if (null != item) { client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, item.ExtProps); } else { client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, PropsCacheManager.ConstExtProps); } }
private void UpdateBuff4GameClient(GameClient client, int bufferGoodsID, object tagInfo, bool add) { try { KarenBattleQiZhiConfig_East CrystalItem = tagInfo as KarenBattleQiZhiConfig_East; if (null != CrystalItem) { int BuffTime = 0; BufferItemTypes buffItemType = BufferItemTypes.None; if (null != CrystalItem) { BuffTime = CrystalItem.HoldTme; buffItemType = BufferItemTypes.KarenEastCrystal; } KarenBattleScene scene; if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene)) { EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsID); if (null != item) { if (add) { double[] actionParams = new double[] { (double)BuffTime, (double)bufferGoodsID }; Global.UpdateBufferData(client, buffItemType, actionParams, 1, true); client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.BufferByGoodsProps, bufferGoodsID, item.ExtProps }); string Key = this.BuildSceneBuffKey(client, bufferGoodsID); scene.SceneBuffDict[Key] = new KarenBattleSceneBuff { RoleID = client.ClientData.RoleID, BuffID = bufferGoodsID, EndTicks = TimeUtil.NOW() + (long)(BuffTime * 1000), tagInfo = tagInfo }; if (buffItemType == BufferItemTypes.KarenEastCrystal) { client.SceneContextData = tagInfo; } } else { double[] array = new double[2]; double[] actionParams = array; Global.UpdateBufferData(client, buffItemType, actionParams, 1, true); client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.BufferByGoodsProps, bufferGoodsID, PropsCacheManager.ConstExtProps }); Global.RemoveBufferData(client, (int)buffItemType); string Key = this.BuildSceneBuffKey(client, bufferGoodsID); scene.SceneBuffDict.Remove(Key); if (buffItemType == BufferItemTypes.KarenEastCrystal) { client.SceneContextData = null; } } GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); } } } } catch (Exception ex) { LogManager.WriteException(ex.ToString()); } }
public static void AddTempBufferProp(GameClient client, BufferItemTypes bufferID, int type) { EquipPropItem item = null; if (Global.CanMapUseBuffer(client.ClientData.MapCode, (int)bufferID)) { BufferData bufferData = Global.GetBufferDataByID(client, (int)bufferID); if (null != bufferData) { if (!Global.IsBufferDataOver(bufferData, 0L)) { int bufferGoodsId = 0; if (type == 0) { int goodsIndex; if (bufferID == BufferItemTypes.ZuanHuang) { goodsIndex = client.ClientData.VipLevel; } else { goodsIndex = (int)bufferData.BufferVal; } int[] goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferID); if (null == goodsIds) { goto IL_F8; } if (goodsIndex < 0 || goodsIndex >= goodsIds.Length) { goto IL_F8; } bufferGoodsId = goodsIds[goodsIndex]; } else if (type == 1) { bufferGoodsId = (int)bufferData.BufferVal; } if (bufferGoodsId > 0) { item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsId); } } } } IL_F8: if (null != item) { client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.BufferByGoodsProps, bufferID, item.ExtProps }); } else { client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.BufferByGoodsProps, bufferID, PropsCacheManager.ConstExtProps }); } }
/// <summary> /// 添加、移除buff /// </summary> /// <param name="scene"></param> /// <param name="client"></param> /// <param name="buffType"></param> /// <param name="buffCfg"></param> /// <param name="bAdd"></param> private void ModifyBuff(CoupleArenaCopyScene scene, GameClient client, BufferItemTypes buffType, CoupleArenaBuffCfg buffCfg, bool bAdd) { if (scene == null || client == null || buffCfg == null) { return; } lock (Mutex) { bool bChanged = false; BufferData buffData = Global.GetBufferDataByID(client, (int)buffType); int noSaveDbBuffType = 1; if (bAdd && (buffData == null || Global.IsBufferDataOver(buffData))) { // 持有真爱buff的玩家无法获得勇气buff if (buffType != BufferItemTypes.CoupleArena_YongQi_Buff || scene.ZhenAiBuff_Role != client.ClientData.RoleID) { double[] bufferParams = new double[1] { 1 }; Global.UpdateBufferData(client, buffType, bufferParams, noSaveDbBuffType); foreach (var prop in buffCfg.ExtProps) { client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.CoupleArena, (int)prop.Key, prop.Value); } bChanged = true; } } if (!bAdd && buffData != null && !Global.IsBufferDataOver(buffData)) { double[] bufferParams = new double[1] { 0 }; Global.UpdateBufferData(client, buffType, bufferParams, noSaveDbBuffType); foreach (var prop in buffCfg.ExtProps) { client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.CoupleArena, (int)prop.Key, 0); } bChanged = true; } if (bChanged) { if (buffType == BufferItemTypes.CoupleArena_ZhenAi_Buff) { if (bAdd) { scene.ZhenAiBuff_Role = client.ClientData.RoleID; scene.ZhenAiBuff_StartMs = TimeUtil.NOW(); } else { scene.ZhenAiBuff_Role = 0; } } else if (buffType == BufferItemTypes.CoupleArena_YongQi_Buff) { if (bAdd) { scene.YongQiBuff_Role = client.ClientData.RoleID; } else { scene.YongQiBuff_Role = 0; } } NtfBuffHoldData(scene); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); // 总生命值和魔法值变化通知(同一个地图才需要通知) GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); } } }