public override void Tick(RealmTime time)
        {
            bool hasItem = false;
            foreach (Item i in Inventory)
                if (i != null)
                {
                    hasItem = true;
                    break;
                }

            if (!hasItem)
            {
                StaticObject obj = new StaticObject(Manager, 0x0743, null, false, false, false);
                obj.Move(X, Y);
                World w = Owner;
                Owner.LeaveWorld(this);
                w.EnterWorld(obj);
            }
            base.Tick(time);
        }
예제 #2
0
 public void Execute(Player player, string[] args)
 {
     var name = "";
     var maxed = 0;
     var rand = new Random();
     try
     {
         if (args.Length == 0)
         {
             var list = new List<string>();
             var num = 0;
             foreach (var i in RealmManager.Clients.Values)
             {
                 list.Add(i.Account.Name);
                 num++;
             }
             var array = list.ToArray();
             var random = new Random();
             var length = array.Length;
             name = array[random.Next(0, length - 1)];
             maxed = rand.Next(1, 11);
         }
         else if (args.Length == 1)
         {
             name = args[0];
             maxed = rand.Next(1, 11);
         }
         else if (args.Length == 2)
         {
             name = args[0];
             maxed = int.Parse(args[1]);
         }
         else
         {
             var list = new List<string>();
             var num = 0;
             foreach (var i in RealmManager.Clients.Values)
             {
                 list.Add(i.Account.Name);
                 num++;
             }
             var array = list.ToArray();
             var random = new Random();
             var length = array.Length;
             name = array[random.Next(0, length - 1)];
             maxed = rand.Next(1, 11);
         }
     }
     catch
     {
     }
     short objType;
     int? time;
     switch (maxed)
     {
         case 11:
             objType = 0x0725;
             time = 5*60*1000;
             break;
         case 10:
             objType = 0x0724;
             time = 60*1000;
             break;
         case 9:
             objType = 0x0723;
             time = 30*1000;
             break;
         case 8:
             objType = 0x0735;
             time = null;
             break;
         case 7:
             objType = 0x0734;
             time = null;
             break;
         case 6:
             objType = 0x072b;
             time = null;
             break;
         case 5:
             objType = 0x072a;
             time = null;
             break;
         case 4:
             objType = 0x0729;
             time = null;
             break;
         case 3:
             objType = 0x0728;
             time = null;
             break;
         case 2:
             objType = 0x0727;
             time = null;
             break;
         case 1:
             objType = 0x0726;
             time = null;
             break;
         default:
             objType = 0x0725;
             time = 5*60*1000;
             break;
     }
     var obj = new StaticObject(objType, time, true, time == null ? false : true, false);
     obj.Move(player.X, player.Y);
     obj.Name = name;
     player.Owner.EnterWorld(obj);
 }
예제 #3
0
        private void GenerateGravestone()
        {
            int    maxed = GetMaxed().Count;
            ushort objType;
            int?   time;

            switch (maxed)
            {
            case 8:
                objType = 0x0735;
                time    = null;
                break;

            case 7:
                objType = 0x0734;
                time    = null;
                break;

            case 6:
                objType = 0x072b;
                time    = null;
                break;

            case 5:
                objType = 0x072a;
                time    = null;
                break;

            case 4:
                objType = 0x0729;
                time    = null;
                break;

            case 3:
                objType = 0x0728;
                time    = null;
                break;

            case 2:
                objType = 0x0727;
                time    = null;
                break;

            case 1:
                objType = 0x0726;
                time    = null;
                break;

            default:
                if (Level <= 1)
                {
                    objType = 0x0723;
                    time    = 30 * 1000;
                }
                else if (Level < 20)
                {
                    objType = 0x0724;
                    time    = 60 * 1000;
                }
                else
                {
                    objType = 0x0725;
                    time    = 5 * 60 * 1000;
                }
                break;
            }
            var obj = new StaticObject(Manager, objType, time, true, time != null, false);

            obj.Move(X, Y);
            obj.Name = Name;
            Owner.EnterWorld(obj);
        }
예제 #4
0
        void GenerateGravestone()
        {
            int maxed = 0;
            foreach (var i in XmlDatas.TypeToElement[ObjectType].Elements("LevelIncrease"))
            {
                int limit = int.Parse(XmlDatas.TypeToElement[ObjectType].Element(i.Value).Attribute("max").Value);
                int idx = StatsManager.StatsNameToIndex(i.Value);
                if (Stats[idx] >= limit)
                    maxed++;
            }

            short objType;
            int? time;
            switch (maxed)
            {
                case 8:
                    objType = 0x0735; time = null;
                    break;
                case 7:
                    objType = 0x0734; time = null;
                    break;
                case 6:
                    objType = 0x072b; time = null;
                    break;
                case 5:
                    objType = 0x072a; time = null;
                    break;
                case 4:
                    objType = 0x0729; time = null;
                    break;
                case 3:
                    objType = 0x0728; time = null;
                    break;
                case 2:
                    objType = 0x0727; time = null;
                    break;
                case 1:
                    objType = 0x0726; time = null;
                    break;
                default:
                    if (Level <= 1)
                    {
                        objType = 0x0723; time = 30 * 1000;
                    }
                    else if (Level < 20)
                    {
                        objType = 0x0724; time = 60 * 1000;
                    }
                    else
                    {
                        objType = 0x0725; time = 5 * 60 * 1000;
                    }
                    break;
            }
            StaticObject obj = new StaticObject(objType, time, true, time == null ? false : true, false);
            obj.Move(X, Y);
            obj.Name = this.Name;
            Owner.EnterWorld(obj);
        }
예제 #5
0
        void GenerateGravestone()
        {
            int maxed = 0;

            foreach (var i in XmlDatas.TypeToElement[ObjectType].Elements("LevelIncrease"))
            {
                int limit = int.Parse(XmlDatas.TypeToElement[ObjectType].Element(i.Value).Attribute("max").Value);
                int idx   = StatsManager.StatsNameToIndex(i.Value);
                if (Stats[idx] >= limit)
                {
                    maxed++;
                }
            }

            short objType;
            int?  time;

            switch (maxed)
            {
            case 8:
                objType = 0x0735; time = null;

                /*
                 * if (player.objType = 782) //Wizard
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 784) //Priest
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 768) //Rogue
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 801) //Necromancer
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 798) //Knight
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 800) //Assassin
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 802) //Huntress
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 804) //Trickster
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 775)  //Warrior
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 *
                 * else if (player.objType = 782)
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 782)
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 782)
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 782)
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 * else if (player.objType = 782)
                 * {
                 *  objType = 0x0723; time = null;
                 * }
                 */
                break;

            case 7:
                objType = 0x0734; time = null;
                break;

            case 6:
                objType = 0x072b; time = null;
                break;

            case 5:
                objType = 0x072a; time = null;
                break;

            case 4:
                objType = 0x0729; time = null;
                break;

            case 3:
                objType = 0x0728; time = null;
                break;

            case 2:
                objType = 0x0727; time = null;
                break;

            case 1:
                objType = 0x0726; time = null;
                break;

            default:
                if (Level <= 1)
                {
                    objType = 0x0723; time = 30 * 1000;
                }
                else if (Level < 20)
                {
                    objType = 0x0724; time = 60 * 1000;
                }
                else
                {
                    objType = 0x0725; time = 5 * 60 * 1000;
                }
                break;
            }
            StaticObject obj = new StaticObject(objType, time, true, time == null ? false : true, false);

            obj.Move(X, Y);
            obj.Name = this.Name;
            Owner.EnterWorld(obj);
        }
예제 #6
0
파일: Player.cs 프로젝트: Club559/Mining
        void GenerateGravestone()
        {
            int maxed = 0;
            foreach (var i in XmlDatas.TypeToElement[ObjectType].Elements("LevelIncrease"))
            {
                int limit = int.Parse(XmlDatas.TypeToElement[ObjectType].Element(i.Value).Attribute("max").Value);
                int idx = StatsManager.StatsNameToIndex(i.Value);
                if (Stats[idx] >= limit)
                    maxed++;
            }

            short objType;
            int? time;
            switch (maxed)
            {
                case 8:
                    objType = 0x0735; time = null;
                    /*
                    if (player.objType = 782) //Wizard
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 784) //Priest
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 768) //Rogue
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 801) //Necromancer
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 798) //Knight
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 800) //Assassin
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 802) //Huntress
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 804) //Trickster
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 775)  //Warrior
                    {
                        objType = 0x0723; time = null;
                    }
                     *
                    else if (player.objType = 782)
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 782)
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 782)
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 782)
                    {
                        objType = 0x0723; time = null;
                    }
                    else if (player.objType = 782)
                    {
                        objType = 0x0723; time = null;
                    }
                    */
                    break;
                case 7:
                    objType = 0x0734; time = null;
                    break;
                case 6:
                    objType = 0x072b; time = null;
                    break;
                case 5:
                    objType = 0x072a; time = null;
                    break;
                case 4:
                    objType = 0x0729; time = null;
                    break;
                case 3:
                    objType = 0x0728; time = null;
                    break;
                case 2:
                    objType = 0x0727; time = null;
                    break;
                case 1:
                    objType = 0x0726; time = null;
                    break;
                default:
                    if (Level <= 1)
                    {
                        objType = 0x0723; time = 30 * 1000;
                    }
                    else if (Level < 20)
                    {
                        objType = 0x0724; time = 60 * 1000;
                    }
                    else
                    {
                        objType = 0x0725; time = 5 * 60 * 1000;
                    }
                    break;
            }
            StaticObject obj = new StaticObject(objType, time, true, time == null ? false : true, false);
            obj.Move(X, Y);
            obj.Name = this.Name;
            Owner.EnterWorld(obj);
        }
예제 #7
0
        private void GenerateGravestone()
        {
            int maxed = 0;

            foreach (var i in Manager.GameData.ObjectTypeToElement[ObjectType].Elements("LevelIncrease"))
            {
                int limit = int.Parse(Manager.GameData.ObjectTypeToElement[ObjectType].Element(i.Value).Attribute("max").Value);
                int idx   = StatsManager.StatsNameToIndex(i.Value);
                if (Stats[idx] >= limit)
                {
                    maxed++;
                }
            }

            ushort objType;
            int?   time;

            switch (maxed)
            {
            case 8:
                objType = 0x0735; time = null;
                break;

            case 7:
                objType = 0x0734; time = null;
                break;

            case 6:
                objType = 0x072b; time = null;
                break;

            case 5:
                objType = 0x072a; time = null;
                break;

            case 4:
                objType = 0x0729; time = null;
                break;

            case 3:
                objType = 0x0728; time = null;
                break;

            case 2:
                objType = 0x0727; time = null;
                break;

            case 1:
                objType = 0x0726; time = null;
                break;

            default:
                if (Level <= 1)
                {
                    objType = 0x0723; time = 30 * 1000;
                }
                else if (Level < 20)
                {
                    objType = 0x0724; time = 60 * 1000;
                }
                else
                {
                    objType = 0x0725; time = 5 * 60 * 1000;
                }
                break;
            }
            StaticObject obj = new StaticObject(Manager, objType, time, true, time == null ? false : true, false);

            obj.Move(X, Y);
            obj.Name = Name;
            Owner.EnterWorld(obj);
        }
        private void Init(Client psr)
        {
            AccountId = psr.Account.AccountId;
            PlayerOwnerName = psr.Account.Name;

            List<IntPoint> vaultChestPosition = new List<IntPoint>();
            List<IntPoint> giftChestPosition = new List<IntPoint>();
            IntPoint spawn = new IntPoint(0, 0);

            int w = Map.Width;
            int h = Map.Height;
            for (int y = 0; y < h; y++)
                for (int x = 0; x < w; x++)
                {
                    WmapTile tile = Map[x, y];
                    if (tile.Region == TileRegion.Spawn)
                        spawn = new IntPoint(x, y);
                    else if (tile.Region == TileRegion.Vault)
                        vaultChestPosition.Add(new IntPoint(x, y));
                    else if (tile.Region == TileRegion.Gifting_Chest)
                        giftChestPosition.Add(new IntPoint(x, y));
                }
            vaultChestPosition.Sort((x, y) => Comparer<int>.Default.Compare(
                (x.X - spawn.X) * (x.X - spawn.X) + (x.Y - spawn.Y) * (x.Y - spawn.Y),
                (y.X - spawn.X) * (y.X - spawn.X) + (y.Y - spawn.Y) * (y.Y - spawn.Y)));

            List<VaultChest> chests = psr.Account.Vault.Chests;

            if (psr.Account.Gifts != null)
            {
                List<GiftChest> giftChests = new List<GiftChest>();
                GiftChest c = new GiftChest();
                c.Items = new List<Item>(8);
                bool wasLastElse = false;
                int[] gifts = psr.Account.Gifts.ToArray();
                gifts.Shuffle();
                for (int i = 0; i < gifts.Count(); i++)
                {
                    if (Manager.GameData.Items.ContainsKey((ushort)gifts[i]))
                    {
                        if (c.Items.Count < 8)
                        {
                            c.Items.Add(Manager.GameData.Items[(ushort)gifts[i]]);
                            wasLastElse = false;
                        }
                        else
                        {
                            giftChests.Add(c);
                            c = new GiftChest();
                            c.Items = new List<Item>(8);
                            c.Items.Add(Manager.GameData.Items[(ushort)gifts[i]]);
                            wasLastElse = true;
                        }
                    }
                }
                if (!wasLastElse)
                    giftChests.Add(c);

                foreach (GiftChest chest in giftChests)
                {
                    if (giftChestPosition.Count == 0) break;
                    while (chest.Items.Count < 8)
                        chest.Items.Add(null);
                    OneWayContainer con = new OneWayContainer(Manager, 0x0744, null, false);
                    List<Item> inv = chest.Items;
                    for (int j = 0; j < 8; j++)
                        con.Inventory[j] = inv[j];
                    con.Move(giftChestPosition[0].X + 0.5f, giftChestPosition[0].Y + 0.5f);
                    EnterWorld(con);
                    giftChestPosition.RemoveAt(0);
                }
            }

            foreach (VaultChest t in chests)
            {
                if (vaultChestPosition.Count == 0) break;
                Container con = new Container(Manager, 0x0504, null, false);
                Item[] inv =
                    t.Items.Select(
                        _ =>
                            _ == -1
                                ? null
                                : (Manager.GameData.Items.ContainsKey((ushort)_)
                                    ? Manager.GameData.Items[(ushort)_]
                                    : null))
                        .ToArray();
                for (int j = 0; j < 8; j++)
                    con.Inventory[j] = inv[j];
                con.Move(vaultChestPosition[0].X + 0.5f, vaultChestPosition[0].Y + 0.5f);
                EnterWorld(con);
                vaultChestPosition.RemoveAt(0);

                _vaultChests[new Tuple<Container, VaultChest>(con, t)] = con.UpdateCount;
            }

            foreach (IntPoint i in giftChestPosition)
            {
                StaticObject x = new StaticObject(Manager, 0x0743, null, true, false, false);
                x.Move(i.X + 0.5f, i.Y + 0.5f);
                EnterWorld(x);
            }

            foreach (IntPoint i in vaultChestPosition)
            {
                SellableObject x = new SellableObject(Manager, 0x0505);
                x.Move(i.X + 0.5f, i.Y + 0.5f);
                EnterWorld(x);
            }
        }
예제 #9
0
        public static Entity Resolve(RealmManager manager, ushort id)
        {
            var node = manager.GameData.ObjectTypeToElement[id];
            var cls  = node.Element("Class");

            if (cls == null)
            {
                throw new ArgumentException("Invalid XML Element, field class is missing");
            }
            var type = cls.Value;

            switch (type)
            {
            case "Projectile":
                throw new Exception("Projectile should not instantiated using Entity.Resolve");

            case "Sign":
                return(new Sign(manager, id));

            case "Wall":
            case "DoubleWall":
                return(new Wall(manager, id, node));

            case "ConnectedWall":
            case "CaveWall":
                return(new ConnectedObject(manager, id));

            case "GameObject":
            case "CharacterChanger":
            case "MoneyChanger":
            case "SorForger":
            case "NameChanger":
                return(new StaticObject(manager, id, StaticObject.GetHP(node), StaticObject.GetStatic(node), false, true));

            case "GuildRegister":
            case "GuildChronicle":
            case "GuildBoard":
                return(new StaticObject(manager, id, null, false, false, false));

            case "Container":
                return(new Container(manager, node));

            case "Player":
                throw new Exception("Player should not instantiated using Entity.Resolve");

            case "Character":     //Other characters means enemy
                return(new Enemy(manager, id));

            case "Portal":
            case "GuildHallPortal":
                return(new Portal(manager, id, null));

            case "ClosedVaultChest":
            case "ClosedVaultChestGold":
            case "MarketplaceGround":
            case "ClosedGiftChest":
            case "VaultChest":
            case "Merchant":
                return(new Merchants(manager, id));

            case "GuildMerchant":
                return(new GuildMerchant(manager, id));

            case "ArenaGuard":
            case "ArenaPortal":
            case "MysteryBoxGround":
            case "FurnaceGround":
            case "ReskinVendor":
            case "PetUpgrader":
            case "FortuneTeller":
            case "YardUpgrader":
            case "FortuneGround":
            case "QuestRewards":
                return(new StaticObject(manager, id, null, true, false, false));

            case "SpiderWeb":
                return(new Entity(manager, id));

            case "Pet":
                throw new Exception("Pets should not instantiated using Entity.Resolve");

            default:
                Log.Warn("Not supported type: " + type);
                return(new Entity(manager, id));
            }
        }
예제 #10
0
        void GenerateGravestone(bool phantomDeath = false)
        {
            var    playerDesc = Manager.Resources.GameData.Classes[ObjectType];
            var    maxed      = playerDesc.Stats.Where((t, i) => Stats.Base[i] >= t.MaxValue).Count();
            ushort objType;
            int    time;

            switch (maxed)
            {
            case 8:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0735; time = 600000; break;
                }

            case 7:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0734; time = 600000; break;
                }

            case 6:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x072b; time = 600000; break;
                }

            case 5:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x072a; time = 600000; break;
                }

            case 4:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0729; time = 600000; break;
                }

            case 3:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0728; time = 600000; break;
                }

            case 2:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0727; time = 600000; break;
                }

            case 1:
                if (Client.Account.Rank == 35)
                {
                    objType = 0x0735; time = 600000; break;
                }
                else
                {
                    objType = 0x0726; time = 600000; break;
                }

            default:
                objType = 0x0725; time = 300000;
                if (Level < 20)
                {
                    objType = 0x0724; time = 60000;
                }
                if (Level <= 1)
                {
                    objType = 0x0723; time = 30000;
                }
                else
                if (Client.Account.Rank == 35)
                {
                    if (Level < 20)
                    {
                        objType = 0x0724; time = 60000;
                    }
                }
                if (Level <= 1)
                {
                    objType = 0x0723; time = 30000;
                }
                break;
            }

            var obj = new StaticObject(Manager, objType, time, true, true, false);

            obj.Move(X, Y);
            obj.Name = (!phantomDeath) ? Name : $"{Name} got rekt";
            Owner.EnterWorld(obj);
        }
예제 #11
0
파일: NPC.cs 프로젝트: Club559/RotMGNPCs
 void GenerateGravestone()
 {
     StaticObject obj = new StaticObject(0x0725, 5 * 60 * 1000, true, true, false);
     obj.Move(X, Y);
     obj.Name = this.Name;
     Owner.EnterWorld(obj);
 }
예제 #12
0
 private void GenerateGravestone()
 {
     int maxed = GetMaxed().Count;
     ushort objType;
     int? time;
     switch (maxed)
     {
         case 8:
             objType = 0x0735;
             time = null;
             break;
         case 7:
             objType = 0x0734;
             time = null;
             break;
         case 6:
             objType = 0x072b;
             time = null;
             break;
         case 5:
             objType = 0x072a;
             time = null;
             break;
         case 4:
             objType = 0x0729;
             time = null;
             break;
         case 3:
             objType = 0x0728;
             time = null;
             break;
         case 2:
             objType = 0x0727;
             time = null;
             break;
         case 1:
             objType = 0x0726;
             time = null;
             break;
         default:
             if (Level <= 1)
             {
                 objType = 0x0723;
                 time = 30*1000;
             }
             else if (Level < 20)
             {
                 objType = 0x0724;
                 time = 60*1000;
             }
             else
             {
                 objType = 0x0725;
                 time = 5*60*1000;
             }
             break;
     }
     var obj = new StaticObject(Manager, objType, time, true, time != null, false);
     obj.Move(X, Y);
     obj.Name = Name;
     Owner.EnterWorld(obj);
 }