Example #1
0
 private static void DropGold(Player player, ref MsgItem packet)
 {
     if (player.Money >= packet.UnqiueId)
     {
         FloorItemSystem.DropMoney(null, player, packet.UnqiueId);
     }
     player.Send(packet);
 }
Example #2
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;
            }
            }
        }