Ejemplo n.º 1
0
 private static void DropItem(Player player, ref MsgItem packet)
 {
     if (player.Inventory.Items.TryRemove(packet.UnqiueId, out var found))
     {
         FloorItemSystem.Drop(null, player, found);
         player.Send(packet);
     }
 }
Ejemplo n.º 2
0
        private static void ACTION_RANDACTION(YiObj target, YiObj attacker, cq_action cqaction, SquigglyContext db)
        {
            var nextIds = cqaction.param.Trim().Split(' ');

            var nextIndex = SafeRandom.Next(nextIds.Length);

            var nextId = long.Parse(nextIds[nextIndex]);

            cqaction = db.cq_action.Find(nextId);
            //Output.WriteLine($"Mob Action -> Data: {cqaction.data} Param: {cqaction.param.Trim()}",ConsoleColor.Green);

            var dropId = cqaction.param.Trim().Split(' ')[1];
            var item   = ItemFactory.Create(int.Parse(dropId));

            FloorItemSystem.Drop(attacker, target, item);
        }
Ejemplo n.º 3
0
        private static void ACTION_MST_DROPITEM(YiObj target, YiObj attacker, cq_action cqaction, SquigglyContext db)
        {
            var condition = cqaction.param.Trim();
            var what      = condition.Split(' ')[0];

            switch (what)
            {
            case "dropmoney":
            {
                var maxAmount = int.Parse(condition.Split(' ')[1]);
                var chance    = int.Parse(condition.Split(' ')[2]) / 100;


                if (YiCore.Success(chance))
                {
                    //Output.WriteLine($"{type}:{(int) type} -> {maxAmount} {chance}", ConsoleColor.Green);
                    Process(target, attacker, db.cq_action.Find(cqaction.id_next), db);
                    FloorItemSystem.DropMoney(attacker, target, maxAmount);
                }
                else
                {
                    //Output.WriteLine($"{type}:{(int) type} -> {maxAmount} {chance}", ConsoleColor.Red);
                    Process(target, attacker, db.cq_action.Find(cqaction.id_nextfail), db);
                }

                break;
            }

            case "dropitem":
            {
                var id = int.Parse(condition.Split(' ')[1]);
                //Output.WriteLine($"{type}:{(int) type} -> {id}", ConsoleColor.Green);
                Process(target, attacker, db.cq_action.Find(cqaction.id_next), db);
                FloorItemSystem.Drop(attacker, target, ItemFactory.Create(id));
                Process(target, attacker, db.cq_action.Find(cqaction.id_next), db);
                break;
            }
            }
        }