Exemplo n.º 1
0
        public static void LoadLootTemplates_Reference()
        {
            Log.outInfo(LogFilter.ServerLoading, "Loading reference loot templates...");

            uint oldMSTime = Time.GetMSTime();

            List<uint> lootIdSet;
            Reference.LoadAndCollectLootIds(out lootIdSet);

            // check references and remove used
            Creature.CheckLootRefs(lootIdSet);
            Fishing.CheckLootRefs(lootIdSet);
            Gameobject.CheckLootRefs(lootIdSet);
            Items.CheckLootRefs(lootIdSet);
            Milling.CheckLootRefs(lootIdSet);
            Pickpocketing.CheckLootRefs(lootIdSet);
            Skinning.CheckLootRefs(lootIdSet);
            Disenchant.CheckLootRefs(lootIdSet);
            Prospecting.CheckLootRefs(lootIdSet);
            Mail.CheckLootRefs(lootIdSet);
            Reference.CheckLootRefs(lootIdSet);

            // output error for any still listed ids (not referenced from any loot table)
            Reference.ReportUnusedIds(lootIdSet);

            Log.outInfo(LogFilter.ServerLoading, "Loaded refence loot templates in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime));
        }
Exemplo n.º 2
0
 public Renderer(Gameobject go, string sourceTexture, Rectangle?sourceRectangle, Color color)
     : base(go)
 {
     this.SourceTextureName = sourceTexture;
     this.SourceRectangle   = sourceRectangle == null ? new Rectangle(0, 0, SourceTexture.Width, SourceTexture.Height) : sourceRectangle.Value;
     this.Color             = Color;
 }
Exemplo n.º 3
0
        public static void LoadLootTemplates_Gameobject()
        {
            Log.outInfo(LogFilter.ServerLoading, "Loading gameobject loot templates...");

            uint oldMSTime = Time.GetMSTime();

            List<uint> lootIdSet, lootIdSetUsed = new List<uint>();
            uint count = Gameobject.LoadAndCollectLootIds(out lootIdSet);

            // remove real entries and check existence loot
            var gotc = Global.ObjectMgr.GetGameObjectTemplates();
            foreach (var go in gotc)
            {
                uint lootid = go.Value.GetLootId();
                if (lootid != 0)
                {
                    if (!lootIdSet.Contains(lootid))
                        Gameobject.ReportNonExistingId(lootid, go.Value.entry);
                    else
                        lootIdSetUsed.Add(lootid);
                }
            }

            foreach (var id in lootIdSetUsed)
                lootIdSet.Remove(id);

            // output error for any still listed (not referenced from appropriate table) ids
            Gameobject.ReportUnusedIds(lootIdSet);

            if (count != 0)
                Log.outInfo(LogFilter.ServerLoading, "Loaded {0} gameobject loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
            else
                Log.outError(LogFilter.ServerLoading, "Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
        }
Exemplo n.º 4
0
 public void makeCard(GameObject prefab)
 {
     card = prefab;
     if (isFaceUp)
     {
         card.GetComponent <Sprites>().sprite = frontImage;
     }
     else
     {
         card.GetComponent <Sprites>().sprite = backImage;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Load all the zone objects and items
        /// </summary>
        private void LoadZone()
        {
            // creating the zone's chat channels
            World.ChatManager.CreateChannel(Name, ChannelType.Local, channelId => LocalChatChannel = channelId);
            World.ChatManager.CreateChannel(Name, ChannelType.Trade, channelId => TradeChatChannel = channelId);
            // registering our social world
            World.SocialManager.RegisterWorld(Id);

            // temp doorway
            if (id == 1)
            {
                var doorway = new Dynamic(this, 1, 100, null);
                doorway.InitializeNewDoorway(new Vector3(1, 40, 50), new GlobalPosition(2, new Vector3(1437, 0, 964)));
                this.objectCache.AddItem(doorway);
                this.PrimaryFiber.Enqueue(() => doorway.Spawn(new Vector3(1442, 14, 985.5f), Quaternion.CreateEular(0, 100, 0)));
            }

            // temp doorway
            if (id == 2)
            {
                var doorway = new Dynamic(this, 2, 100, null);
                doorway.InitializeNewDoorway(new Vector3(1, 40, 50), new GlobalPosition(1, new Vector3(1442, 0, 998)));
                this.objectCache.AddItem(doorway);
                this.PrimaryFiber.Enqueue(() => doorway.Spawn(new Vector3(1440, 14, 974.5f), Quaternion.CreateEular(0, 100, 0)));
            }

            using (var session = this.world.WorldDatabase.OpenSession())
            {
                // load all npcs
                foreach (var npcData in session.Query <NpcData>("Npc/ByZoneId").Where(n => n.ZoneId == this.id))
                {
                    var npc = new Npc(this, npcData.Guid, npcData.GroupId, (NpcType)npcData.NpcType, npcData);
                    this.objectCache.AddItem(npc);

                    var position = npcData.Position.ToVector();
                    position.Y = this.GetHeight(position.X, position.Z);
                    var rotation = Quaternion.CreateEular(0, npcData.Orientation, 0);
                    this.PrimaryFiber.Enqueue(() => npc.Spawn(position, rotation));
                }

                // load all game objects
                foreach (var goData in session.Query <GameObjectData>("GameObject/ByZoneId").Where(g => g.ZoneId == this.id))
                {
                    var go = new Gameobject(this, goData.Guid, (GameObjectType)goData.GOType, goData.GroupId, goData);
                    this.objectCache.AddItem(go);

                    var position = goData.Position.ToVector();
                    var rotation = Quaternion.CreateEular(0, goData.Orientation, 0);
                    this.PrimaryFiber.Enqueue(() => go.Spawn(position, rotation));
                }
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Display.DisplaySize(80, 80);

            Scene scene1 = new Scene();

            Gameobject ball = scene1.AddGameobject("ball");

            ball.AddComponet("ball_image", new Image("O"));
            ball.transform.Teleport(5, 5);
            Background background1 = scene1.AddBackground(0, "background1");

            background1.FillBackground(new Image("_"));
        }
Exemplo n.º 7
0
 public void screenChange(Gameobject target)
 {
     foreach (Gameobject screen in screens)
     {
         if (screen == target)
         {
             screen.enabled = true;
         }
         else
         {
             screen.enabled = false;
         }
     }
 }
    public void clicked(Gameobject buttonObj)
    {
        Debug.Log("Button Buy Clicked!");
        Text text = buttonObj.GetComponentInChildren <Text>(true);

        if (text != null)
        {
            textRef.text = "i am a button!"; ´
        }
        Image image = buttonObj.GetComponent <Image>();

        if (image != null)
        {
            image.color = newColor;
        }
    }
    public GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation)   //Creates the object and puts it in queue
    {
        if (!poolDictionary.ContainsKey(tag))
        {
            Debug.LogWarning("Yo! This tag- " + tag + " doesnt exist, maybe check on that!:)")
            return(null); //If the tag is not available, it will send this message
        }

        Gameobject objectToSpawn = poolDictionary[tag].Dequeue    //Pulls the first object in the queue and sets it to objectToSpawn

                                   objectToSpawn.SetActive(true); //spawns object

        objectToSpawn.transform.position = position;              //sets the position of the spawned object
        objectToSpawn.transform.rotation = rotation;              //sets the rotation of the spawned object

        poolDictionary[tag].Enqueue(objectToSpawn);               //Adds the object back into the pool

        return(objectToSpawn);
    }
Exemplo n.º 10
0
        private Gameobject BuildGameobject(DataRow row)
        {
            var gameobject = new Gameobject();

            gameobject.guid          = row["guid"] != DBNull.Value ? CustomConverter.ToInt32(row["guid"]) : 0;
            gameobject.id            = row["id"] != DBNull.Value ? CustomConverter.ToInt32(row["id"]) : 0;
            gameobject.map           = row["map"] != DBNull.Value ? CustomConverter.ToInt32(row["map"]) : 0;
            gameobject.spawnMask     = row["spawnMask"] != DBNull.Value ? CustomConverter.ToInt32(row["spawnMask"]) : 0;
            gameobject.phaseMask     = row["phaseMask"] != DBNull.Value ? CustomConverter.ToInt32(row["phaseMask"]) : 0;
            gameobject.position_x    = row["position_x"] != DBNull.Value ? CustomConverter.ToInt32(row["position_x"]) : 0;
            gameobject.position_y    = row["position_y"] != DBNull.Value ? CustomConverter.ToInt32(row["position_y"]) : 0;
            gameobject.position_z    = row["position_z"] != DBNull.Value ? CustomConverter.ToInt32(row["position_z"]) : 0;
            gameobject.orientation   = row["orientation"] != DBNull.Value ? CustomConverter.ToInt32(row["orientation"]) : 0;
            gameobject.rotation0     = row["rotation0"] != DBNull.Value ? CustomConverter.ToInt32(row["rotation0"]) : 0;
            gameobject.rotation1     = row["rotation1"] != DBNull.Value ? CustomConverter.ToInt32(row["rotation1"]) : 0;
            gameobject.rotation2     = row["rotation2"] != DBNull.Value ? CustomConverter.ToInt32(row["rotation2"]) : 0;
            gameobject.rotation3     = row["rotation3"] != DBNull.Value ? CustomConverter.ToInt32(row["rotation3"]) : 0;
            gameobject.spawntimesecs = row["spawntimesecs"] != DBNull.Value ? CustomConverter.ToInt32(row["spawntimesecs"]) : 0;
            gameobject.animprogress  = row["animprogress"] != DBNull.Value ? CustomConverter.ToInt32(row["animprogress"]) : 0;
            gameobject.state         = row["state"] != DBNull.Value ? CustomConverter.ToInt32(row["state"]) : 0;
            return(gameobject);
        }
Exemplo n.º 11
0
 public Renderer(Gameobject go, string sourceTexture, Rectangle?sourceRectangle)
     : this(go, sourceTexture, sourceRectangle, Color.White)
 {
 }
Exemplo n.º 12
0
 public Renderer(Gameobject go, string sourceTexture)
     : this(go, sourceTexture, null, Color.White)
 {
 }
Exemplo n.º 13
0
 public Component(Gameobject go)
 {
     this.Gameobject = go;
 }
Exemplo n.º 14
0
 public void setBack(GameObject prefab, Sprite CardFace)
 {
     card = prefab;
     card.GetComponent <Sprites>().sprite = CardFace;
 }
Exemplo n.º 15
0
 public Transform(Gameobject go, Vector position) : base(go)
 {
     this.Position = position;
 }
Exemplo n.º 16
0
 void Start()
 {
     life = Gameobject.FindGameObjectWithTag("TimeLeft").GetComponent <GUIHandler1>();
 }