Exemplo n.º 1
0
        protected override void BuildMessage(IEventArgs args)
        {
            this.scope = "4";

            builder.Key = FreeMessageConstant.ScoreInfo;

            //游戏是否开始
            builder.Bs.Add(FreeUtil.ReplaceBool("{gameStart}", args));
            //总玩家数
            builder.Ins.Add(FreeUtil.ReplaceInt("{startPlayerCount}", args));
            //存活者数
            builder.Ins.Add(FreeUtil.ReplaceInt("{playerCount}", args));


            //当前玩家击杀数(每个玩家不一样)
            if (args.GetUnit("current") != null)
            {
                builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args));
            }
            else
            {
                builder.Ins.Add(FreeUtil.ReplaceInt("{current.killNum}", args));
            }


            //击杀者姓名
            if (args.GetUnit("killer") == null)
            {
                builder.Ss.Add(FreeUtil.ReplaceVar("", args));
                builder.Ds.Add(0);
                builder.Ins.Add(0);
                builder.Ins.Add(0);
            }
            else
            {
                //击杀者姓名
                builder.Ss.Add(FreeUtil.ReplaceVar("{killer.name}", args));
                //击杀者队伍ID
                builder.Ds.Add(FreeUtil.ReplaceDouble("{killer.id}", args));
                //击杀者武器ID
                builder.Ins.Add(FreeUtil.ReplaceInt("{killer.currentWeaponId}", args));
                //击杀方式
                builder.Ins.Add(2);
            }

            //死者姓名
            builder.Ss.Add(FreeUtil.ReplaceVar("{killed.name}", args));
            //死者队伍ID
            builder.Ds.Add(FreeUtil.ReplaceDouble("{killed.id}", args));
            //死亡方式
            builder.Ins.Add(1);
        }
Exemplo n.º 2
0
 private static IPara GetPara(IEventArgs args, ParaExp pe)
 {
     if (pe.GetUnit().Equals("robot"))
     {
         foreach (string key in args.GetUnitKeys())
         {
             if (key.Equals("robot"))
             {
                 IParable parable = args.GetUnit(key);
                 if (parable != null && parable.GetType().Name.Equals("FreeData"))
                 {
                     IPara para = parable.GetParameters().Get(pe.GetPara());
                     if (para != null)
                     {
                         return(para);
                     }
                 }
             }
         }
     }
     else
     {
         if (pe.GetUnit().Equals("player"))
         {
             foreach (string key in args.GetUnitKeys())
             {
                 if (!key.Equals("robot"))
                 {
                     IParable parable = args.GetUnit(key);
                     if (parable != null && parable.GetType().Name.Equals("FreeData"))
                     {
                         IPara para = parable.GetParameters().Get(pe.GetPara());
                         if (para != null)
                         {
                             return(para);
                         }
                     }
                 }
             }
         }
         else
         {
             IParable parable = args.GetUnit(pe.GetUnit());
             if (parable != null)
             {
                 return(pe.GetSourcePara(args));
             }
         }
     }
     return(null);
 }
Exemplo n.º 3
0
        public override void DoAction(IEventArgs args)
        {
            string from     = FreeUtil.ReplaceVar(ParaFrom, args);
            string to       = FreeUtil.ReplaceVar(ParaTo, args);
            string itemCat  = FreeUtil.ReplaceVar(ParaItemCat, args);
            int    clipType = FreeUtil.ReplaceInt(ParaClipType, args);

            IParable item = args.GetUnit(FreeArgConstant.Item);

            if (to == ChickenConstant.BagDefault && itemCat == ChickenConstant.ItemCatGrenadeWeapon)
            {
                HandleAddGrenade(args);
            }
            if (from == ChickenConstant.BagDefault && itemCat == ChickenConstant.ItemCatGrenadeWeapon)
            {
                HandleRemoveGrenade(args);
            }
            if (to == ChickenConstant.BagDefault && item.GetParameters().HasPara(ClipType))
            {
                HandleSetClip(args, clipType);
            }
            else if (from == ChickenConstant.BagDefault && item.GetParameters().HasPara(ClipType))
            {
                HandleClearClip(args, clipType);
            }

            HandleCapacity(args);
        }
Exemplo n.º 4
0
        public virtual IPara GetTargetPara(IEventArgs args, IPara source)
        {
            IPara replace = ExpSetParser.GetReplaceValue(unitPara.GetPara(), args);

            if (replace != null)
            {
                return(replace);
            }
            IParable p1 = args.GetUnit(unitPara.GetUnit());

            if (p1 != null)
            {
                IPara p = unitPara.GetPara(args);
                if (p == null)
                {
                    p = source.Initial(op, unitPara.GetPara());
                }
                return(p);
            }
            else
            {
                if (!StringUtil.IsNullOrEmpty(unitPara.GetUnit()))
                {
                    return(source.Initial(op, unitPara.GetUnit() + "." + unitPara.GetPara()));
                }
                else
                {
                    return(source.Initial(op, unitPara.GetPara()));
                }
            }
        }
Exemplo n.º 5
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null)
                {
                    ParaListSet      pls     = (ParaListSet)sort;
                    IList <ParaList> removes = new List <ParaList>();
                    foreach (ParaList pl in pls)
                    {
                        if (StringUtil.IsNullOrEmpty(exp) || pl.Meet(exp))
                        {
                            removes.Add(pl);
                        }
                    }
                    foreach (ParaList pl_1 in removes)
                    {
                        pls.RemoveParaList(pl_1);
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override void DoAction(IEventArgs args)
        {
            if (string.IsNullOrEmpty(player))
            {
                player = "current";
            }

            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            PlayerEntity playerEntity = (PlayerEntity)fr.GetEntity(player);

            IParable item = args.GetUnit("item");

            if (playerEntity != null && item != null)
            {
                SimpleProto message = FreePool.Allocate();
                message.Key = FreeMessageConstant.ChangeAvatar;

                int itemId = FreeUtil.ReplaceInt("{item.itemId}", args);

                if (takeoff)
                {
                    TakeOff(playerEntity, itemId);
                }
                else
                {
                    PutOn(playerEntity, itemId);
                }

                ReduceDamageUtil.UpdateArmorAndHelmet((FreeData)playerEntity.freeData.FreeData);
            }
        }
Exemplo n.º 7
0
        private void HandleDropWeapon(IEventArgs args)
        {
            if ("DropWeapon" == code)
            {
                int      key = FreeUtil.ReplaceInt("{key}", args);
                FreeData fd  = (FreeData)args.GetUnit("current");

                ItemInventory defInv = fd.freeInventory.GetInventoryManager().GetDefaultInventory();
                for (int i = 1; i <= 5; i++)
                {
                    ItemInventory ii = fd.freeInventory.GetInventoryManager().GetInventory("w" + key + "" + i);
                    if (ii.posList.Count > 0)
                    {
                        ItemPosition ip = ii.posList[0];
                        if (BagCapacityUtil.CanAddToBag(args, fd, ip))
                        {
                            int[] next = defInv.GetNextEmptyPosition(ip.key);
                            ItemInventoryUtil.MovePosition(ip, defInv, next[0], next[1], (ISkillArgs)args);
                        }
                        else
                        {
                            ItemInventory ground = fd.freeInventory.GetInventoryManager().GetInventory("ground");
                            int[]         next   = ground.GetNextEmptyPosition(ip.key);
                            ItemInventoryUtil.MovePosition(ip, ground, next[0], next[1], (ISkillArgs)args);
                        }
                    }
                }

                CarryClipUtil.AddCurrentClipToBag(key, fd, args);
            }
        }
Exemplo n.º 8
0
        public override TestValue GetCaseValue(IEventArgs args)
        {
            TestValue tv = new TestValue();

            FreeData fd = (FreeData)args.GetUnit(UnitTestConstant.Tester);

            //tv.AddField("动作", fd.Player.state.ActionStateId);
            //tv.AddField("移动", fd.Player.state.MovementStateId);

            tv.AddField("动作状态标识", fd.Player.state.ActionStateId);       //动作

            tv.AddField("动作转换标识", fd.Player.state.ActionTransitionId);

            tv.AddField("移动状态标识", fd.Player.state.MovementStateId);     //移动

            tv.AddField("移动转换标识", fd.Player.state.MovementTransitionId);

            tv.AddField("保持状态标识", fd.Player.state.KeepStateId);

            tv.AddField("保持转换标识", fd.Player.state.KeepTransitionId);

            tv.AddField("姿势状态标识", fd.Player.state.PostureStateId);

            tv.AddField("姿势转换标识", fd.Player.state.PostureTransitionId);

            tv.AddField("倾斜状态标识", fd.Player.state.LeanStateId);

            tv.AddField("倾斜转换标识", fd.Player.state.LeanTransitionId);

            return(tv);
        }
Exemplo n.º 9
0
        public override void DoAction(IEventArgs args)
        {
            int          id = 0;
            PlayerEntity p  = GetPlayerEntity(args);

            if (p != null)
            {
                if (id == 0 && !string.IsNullOrEmpty(target))
                {
                    FreeData fd = (FreeData)args.GetUnit(target);
                    if (fd != null)
                    {
                        id = fd.Player.entityKey.Value.EntityId;
                    }

                    if (id == 0)
                    {
                        foreach (FreeMoveEntity freeMoveEntity in args.GameContext.freeMove.GetEntities())
                        {
                            if (freeMoveEntity.freeData.Key == target)
                            {
                                id = freeMoveEntity.entityKey.Value.EntityId;
                            }
                        }
                    }
                }

                p.gamePlay.CameraEntityId = id;
            }
        }
Exemplo n.º 10
0
        public override void DoAction(IEventArgs args)
        {
            FreeData targetPlayer = ((FreeData)args.GetUnit(this.player));

            if (bufs != null)
            {
                foreach (FreeBuf buf in bufs)
                {
                    FreeBuf copy = (FreeBuf)SerializeUtil.Clone(buf);
                    if (targetPlayer != null)
                    {
                        copy.SetCreator(targetPlayer.Player);
                    }
                    if (!copy.OnCreate(args))
                    {
                        continue;
                    }
                    args.TempUse("buf", copy);
                    try
                    {
                        args.FreeContext.Bufs.AddFreeBuf(copy, args);
                    }
                    catch (Exception e)
                    {
                        Sharpen.Runtime.PrintStackTrace(e);
                    }
                    args.Resume("buf");
                }
            }
        }
Exemplo n.º 11
0
        public override void DoAction(IEventArgs args)
        {
            IParable p = null;

            if (StringUtil.IsNullOrEmpty(key))
            {
                p = args.GetDefault();
            }
            else
            {
                p = args.GetUnit(key);
            }
            if (p != null && paras != null)
            {
                foreach (ParaValue para in paras)
                {
                    if (null == para)
                    {
                        throw new GameConfigExpception("para is not a null field at " + key);
                    }
                    if (!p.GetParameters().HasPara(para.GetName()) || @override)
                    {
                        p.GetParameters().AddPara(para.GetPara(args));
                    }
                }
            }
            if (paras == null || paras.Count == 0)
            {
                _logger.Info("AddParaValueAction paras is null or count is 0 !");
            }
        }
Exemplo n.º 12
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null)
                {
                    ParaListSet pls = (ParaListSet)sort;
                    if (action != null)
                    {
                        ParaListSet temp = pls.Sort(FreeUtil.ReplaceVar(exp, args));
                        temp.SetName(pls.GetName());
                        unit.GetParameters().TempUse(temp);
                        action.Act(args);
                        unit.GetParameters().Resume(temp.GetName());
                    }
                    if (!keep)
                    {
                        pls.ReOrder();
                    }
                }
            }
        }
Exemplo n.º 13
0
        public override void DoAction(IEventArgs args)
        {
            IParable p = null;

            if (StringUtil.IsNullOrEmpty(key))
            {
                p = args.GetDefault();
            }
            else
            {
                p = args.GetUnit(key);
            }
            if (p != null && paras != null)
            {
                foreach (IPara para in paras)
                {
                    if (!p.GetParameters().HasPara(para) || @override)
                    {
                        IPara clone = (IPara)para.Copy();
                        clone.SetName(FreeUtil.ReplaceVar(clone.GetName(), args));
                        p.GetParameters().AddPara(clone);
                    }
                }
            }
        }
Exemplo n.º 14
0
        public override void DoAction(IEventArgs args)
        {
            if (string.IsNullOrEmpty(player))
            {
                player = "current";
            }

            FreeRuleEventArgs fr           = (FreeRuleEventArgs)args;
            PlayerEntity      playerEntity = (PlayerEntity)fr.GetEntity(player);

            IParable item = args.GetUnit("item");

            if (playerEntity != null && item != null)
            {
            }

            /*SimpleProto message = FreePool.Allocate();
             * message.Key = FreeMessageConstant.ChangeAvatar;
             *
             * int itemId = FreeUtil.ReplaceInt("{item.itemId}", args);
             *
             * playerEntity.WeaponController().PickUpWeapon(WeaponUtil.CreateScan(itemId));
             * //playerEntity.bag.Bag.SetWeaponBullet(30);
             * //playerEntity.bag.Bag.SetReservedCount(100);
             *
             * message.Ins.Add(itemId);
             *
             * message.Ks.Add(2);
             *
             * playerEntity.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);*/
        }
Exemplo n.º 15
0
        public bool Meet(IEventArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit(player);

            if (fd != null)
            {
                if (fd.Player.stateInterface.State.GetNextActionKeepState() == ActionKeepInConfig.Sight)
                {
                    return(false);
                }
                var states  = fd.Player.StateInteractController().GetCurrStates();
                var manager = SingletonManager.Get <StateTransitionConfigManager>();
                foreach (var state in states)
                {
                    StateTransitionConfigItem condition = manager.GetConditionByState(state);
                    if (condition == null)
                    {
                        continue;
                    }
                    if (!condition.GetTransition(Transition.IsUseAction) /*IsUseAction*/)
                    {
                        return(false);
                    }
                }
                return(fd.Player.hasRaycastTarget && fd.Player.raycastTarget.Key == key);
            }
            return(false);
        }
Exemplo n.º 16
0
 public void SendMessage(IEventArgs args, SimpleProto message, int scope, string player)
 {
     //PlayerEntity[] players = args.GameContext.player.GetInitializedPlayerEntities();
     PlayerEntity[] players = args.GameContext.player.GetEntities();
     if (scope == 4)
     {
         foreach (PlayerEntity p in players)
         {
             if (p.hasNetwork)
             {
                 p.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);
             }
         }
     }
     else if (scope == 1)
     {
         IParable unit = args.GetUnit(FreeUtil.ReplaceVar(player, args));
         if (unit != null)
         {
             PlayerEntity p = ((FreeData)unit).Player;
             if (p.hasNetwork)
             {
                 p.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);
             }
         }
     }
 }
Exemplo n.º 17
0
        public override void DoAction(IEventArgs args)
        {
            if (StringUtil.IsNullOrEmpty(key))
            {
                key = BaseEventArgs.DEFAULT;
            }
            IParable unit = args.GetUnit(key);

            if (unit != null)
            {
                IPara sort = unit.GetParameters().Get(sorter);
                if (sort != null && sort is ParaListSet)
                {
                    ParaListSet pls = (ParaListSet)sort;
                    IParable    pa  = Get();
                    if (action != null)
                    {
                        args.TempUse(TEMP_SORT, pa);
                        args.TempUse("element", pa);
                        action.Act(args);
                        args.Resume("element");
                        args.Resume(TEMP_SORT);
                    }
                    pls.AddParaList(pa.GetParameters());
                }
            }
        }
Exemplo n.º 18
0
        public override void DoAction(IEventArgs args)
        {
            IParable pa    = args.GetUnit(key);
            IParable other = args.GetUnit(from);

            if (pa != null && other != null)
            {
                if (StringUtil.IsNullOrEmpty(fields))
                {
                    AddTo(other.GetParameters().GetFields(), other, pa.GetParameters());
                }
                else
                {
                    AddTo(StringUtil.Split(fields, ","), other, pa.GetParameters());
                }
            }
        }
Exemplo n.º 19
0
        private void HandleFogDamage(IEventArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit("current");

            if (fd != null)
            {
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 更新背包的容量
        /// </summary>
        /// <param name="args"></param>
        private void HandleCapacity(IEventArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit(FreeArgConstant.PlayerCurrent);

            if (fd != null)
            {
                ChickenFuncUtil.UpdateBagCapacity(args, (int)Math.Ceiling(BagCapacityUtil.GetWeight(fd)), BagCapacityUtil.GetCapacity(fd));
            }
        }
Exemplo n.º 21
0
        public FreeData GetPlayer(IEventArgs args)
        {
            if (!string.IsNullOrEmpty(player))
            {
                return((FreeData)args.GetUnit(player));
            }

            return(null);
        }
Exemplo n.º 22
0
        public override void DoAction(IEventArgs args)
        {
            IPlayerInfo      player = (IPlayerInfo)((ObjectUnit)args.GetUnit("playerInfo")).GetObject;
            LoginSuccMessage room   = (LoginSuccMessage)((ObjectUnit)args.GetUnit("roomInfo")).GetObject;

            HashSet <string> set = new HashSet <string>();

            RoleItem item = SingletonManager.Get <RoleConfigManager>().GetRoleItemById(player.RoleModelId);

            foreach (int id in player.AvatarIds)
            {
                set.UnionWith(GetAvatarAsset(id, (Sex)item.Sex));
            }

            set.UnionWith(GetRoleAsset(item));

            room.PreLoadAssetInfo = Merge(room.PreLoadAssetInfo, set);
        }
Exemplo n.º 23
0
        public override void DoAction(IEventArgs args)
        {
            IParable parable = args.GetUnit(FreeUtil.ReplaceVar(var, args));

            if (parable != null)
            {
                args.SetPara(FreeUtil.ReplaceVar(name, args), parable);
            }
        }
Exemplo n.º 24
0
        public void Start(IEventArgs args)
        {
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            args.TempUse("entity", this);
            args.TempUse(name, this);

            if (createAction != null)
            {
                createAction.Act(args);
            }

            FreeData creator = (FreeData)args.GetUnit("creator");

            if (creator != null)
            {
                CreatorId = creator.Player.playerInfo.EntityId;
            }

            if (skills != null && skills.Count > 0)
            {
                skill = new UnitSkill(this);
                foreach (ISkill sk in skills)
                {
                    skill.AddSkill(sk);
                }
            }

            move.Start(fr, _entity);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            if (effect != null)
            {
                AutoPositionValue auto = new AutoPositionValue();
                auto.SetId(_entity.entityKey.Value.EntityId.ToString());
                auto.SetField("pos");
                effect.AddAuto(auto);

                AutoScaleValue scale = new AutoScaleValue();
                scale.SetId(_entity.entityKey.Value.EntityId.ToString());
                scale.SetField("scale");
                effect.AddAuto(scale);

                effect.SetSelector(new PosAssignSelector(_entity.position.Value.x.ToString(),
                                                         _entity.position.Value.y.ToString(), _entity.position.Value.z.ToString()));

                //Debug.LogFormat("start pos {0}", _entity.position.Value.ToString());

                effect.Act(args);
            }

            args.Resume(name);
            args.Resume("entity");
        }
Exemplo n.º 25
0
        private void HandleBioDamage(IEventArgs args)
        {
            if (code == "BioDamage")
            {
                SimpleProto message = FreePool.Allocate();
                message.Key = FreeMessageConstant.ScoreInfo;
                message.Ks.Add(3);
                message.Bs.Add(true);

                PlayerDamageInfo damageInfo = GetDamageInfo(args);
                IParable         source     = args.GetUnit("source");
                if (null == source)
                {
                    return;
                }
                FreeData freeData = (FreeData)args.GetUnit("source");
                if (null == freeData)
                {
                    return;
                }
                int jobAttribute = 0;
                if (freeData.Player.hasGamePlay)
                {
                    jobAttribute = freeData.Player.gamePlay.JobAttribute;
                }
                if (jobAttribute == (int)EJobAttribute.EJob_EveryMan ||
                    jobAttribute == (int)EJobAttribute.EJob_Hero)
                {
                    return;
                }

                message.Ss.Add(FreeUtil.ReplaceVar("{source.PlayerName}", args));
                message.Ds.Add(FreeUtil.ReplaceDouble("{source.TeamId}", args));
                message.Ins.Add(damageInfo.weaponId);
                message.Ins.Add(damageInfo.KillType);
                message.Ins.Add(damageInfo.KillFeedbackType);

                message.Ss.Add(FreeUtil.ReplaceVar("{target.PlayerName}", args));
                message.Ds.Add(FreeUtil.ReplaceDouble("{target.TeamId}", args));
                message.Ins.Add(damageInfo.type);

                SendMessageAction.sender.SendMessage(args, message, 4, string.Empty);
            }
        }
Exemplo n.º 26
0
        public override void DoAction(IEventArgs args)
        {
            PlayerEntity source = GetPlayerEntity(args);

            FreeData fd = (FreeData)args.GetUnit(target);

            if (source != null && fd != null)
            {
            }
        }
Exemplo n.º 27
0
        public static void SendMessage(IEventArgs args, string player, SimpleProto message)
        {
            IParable unit = args.GetUnit(FreeUtil.ReplaceVar(player, args));

            if (unit != null)
            {
                PlayerEntity p = ((FreeData)unit).Player;
                p.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, message);
            }
        }
Exemplo n.º 28
0
        public PlayerEntity GetPlayerEntity(IEventArgs args)
        {
            if (!string.IsNullOrEmpty(player))
            {
                FreeData fd = (FreeData)args.GetUnit(player);
                return(fd.Player);
            }

            return(null);
        }
Exemplo n.º 29
0
        public bool Meet(IEventArgs args)
        {
            FreeData fd = (FreeData)args.GetUnit(player);

            if (fd != null)
            {
                return(fd.Player.hasRaycastTarget && fd.Player.raycastTarget.Key == key);
            }

            return(false);
        }
Exemplo n.º 30
0
        public override TestValue GetCaseValue(IEventArgs args)
        {
            TestValue tv = new TestValue();

            FreeData fd = (FreeData)args.GetUnit(UnitTestConstant.Tester);

            tv.AddField("动作", fd.Player.state.ActionStateId);
            tv.AddField("移动", fd.Player.state.MovementStateId);

            return(tv);
        }