Exemplo 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);
     }
 }
Exemplo n.º 2
0
 private static void DropGold(Player player, ref MsgItem packet)
 {
     if (player.Money >= packet.UnqiueId)
     {
         FloorItemSystem.DropMoney(null, player, packet.UnqiueId);
     }
     player.Send(packet);
 }
Exemplo n.º 3
0
        public static async Task <bool> Load()
        {
            try
            {
                UniqueIdGenerator.Load();
                LoadItems();
                SquigglyDb.LoadMaps();
                SquigglyDb.LoadMobs();
                SquigglyDb.LoadSpawns();
                SquigglyDb.LoadNpcs();
                SquigglyDb.LoadLevelExp();
                SquigglyDb.LoadPortals();
                SquigglyDb.LoadItemBonus();
                SquigglyDb.Spawn();

                await Task.WhenAll(LoadStatpoints(), LoadSkills(), LoadAccounts(),
                                   LoadFloorItems(), LoadStoragePool(), LoadBoothPool());


                StorageSystem.SetUpStorageSpaces();
                BoothSystem.SetUpBooths();
                FloorItemSystem.SetUpFloorItemSystem();

                Output.WriteLine("|------------ Player Data ------------");
                Output.WriteLine("|");
                Output.WriteLine("|---> Accounts:     " + SelectorSystem.Players.Count);
                Output.WriteLine("|---> Storages:     " + StorageSystem.StoragePool.Count);
                Output.WriteLine("|---> Booths:       " + BoothSystem.BoothPool.Count);
                Output.WriteLine("|");
                Output.WriteLine("|------------ Common Data ------------");
                Output.WriteLine("|");
                Output.WriteLine("|---> Bots:         " + GameWorld.CountBots());
                Output.WriteLine("|---> Monsters:     " + GameWorld.CountMonsters());
                Output.WriteLine("|---> Npcs:         " + GameWorld.CountNpcs());
                Output.WriteLine("|---> DynamicNpcs:  " + GameWorld.CountDynNpcs());
                Output.WriteLine("|---> Maps:         " + GameWorld.Maps.Count);
                Output.WriteLine("|---> FloorItems:   " + FloorItemSystem.FloorItems.Count);
                Output.WriteLine("|---> Items:        " + Collections.Items.Count);
                Output.WriteLine("|---> ItemBonus:    " + Collections.ItemBonus.Count);
                Output.WriteLine("|---> LevelExp:     " + Collections.LevelExps.Count);
                Output.WriteLine("|---> StatPoints:   " + Collections.Statpoints.Count);
                Output.WriteLine("|---> Skills:       " + Collections.Skills.Count);
                Output.WriteLine("|---> Portals:      " + Collections.Portals.Count);
                Output.WriteLine("|---> Mob Drops:    " + MobDropSystem.Drops.Count);
                await SetUpScriptingEngine();

                Output.WriteLine("|-------------------------------------");
                Output.WriteLine("");
                GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency;
                YiCore.CompactLoh();
                return(true);
            }
            catch (Exception ex)
            {
                Output.WriteLine(ex);
                return(false);
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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;
            }
            }
        }
Exemplo n.º 6
0
 private static void PickupItem(Player player, ref MsgFloorItem packet) => FloorItemSystem.Pickup(player, packet.UniqueId);