コード例 #1
0
        private void ReloadStaticItem(ushort region, string arg1, string arg2)
        {
            if (region == 0)
            {
                log.Info("Region reload not supported from console.");
                return;
            }

            foreach (GameStaticItem staticItem in WorldMgr.GetStaticItemFromRegion(region))
            {
                if (!staticItem.LoadedFromScript)
                {
                    if (arg1 == "all")
                    {
                        staticItem.RemoveFromWorld();

                        WorldObject obj = GameServer.Database.FindObjectByKey <WorldObject>(staticItem.InternalID);
                        if (obj != null)
                        {
                            staticItem.LoadFromDatabase(obj);
                            staticItem.AddToWorld();
                        }
                    }

                    if (arg1 == "realm")
                    {
                        eRealm realm = eRealm.None;
                        if (arg2 == "None")
                        {
                            realm = eRealm.None;
                        }
                        if (arg2 == "Albion")
                        {
                            realm = eRealm.Albion;
                        }
                        if (arg2 == "Midgard")
                        {
                            realm = eRealm.Midgard;
                        }
                        if (arg2 == "Hibernia")
                        {
                            realm = eRealm.Hibernia;
                        }

                        if (staticItem.Realm == realm)
                        {
                            staticItem.RemoveFromWorld();

                            WorldObject obj = GameServer.Database.FindObjectByKey <WorldObject>(staticItem.InternalID);
                            if (obj != null)
                            {
                                staticItem.LoadFromDatabase(obj);
                                staticItem.AddToWorld();
                            }
                        }
                    }

                    if (arg1 == "name")
                    {
                        if (staticItem.Name == arg2)
                        {
                            staticItem.RemoveFromWorld();

                            WorldObject obj = GameServer.Database.FindObjectByKey <WorldObject>(staticItem.InternalID);
                            if (obj != null)
                            {
                                staticItem.LoadFromDatabase(obj);
                                staticItem.AddToWorld();
                            }
                        }
                    }

                    if (arg1 == "model")
                    {
                        if (staticItem.Model == Convert.ToUInt16(arg2))
                        {
                            staticItem.RemoveFromWorld();

                            WorldObject obj = GameServer.Database.FindObjectByKey <WorldObject>(staticItem.InternalID);
                            if (obj != null)
                            {
                                staticItem.LoadFromDatabase(obj);
                                staticItem.AddToWorld();
                            }
                        }
                    }
                }
            }
        }