示例#1
0
        public override void AddRecipeGroups()
        {
            if (!Main.dedServ)
            {
                try
                {
                    itemBrowser = new ItemBrowser(this);
                    itemBrowser.SetDefaultPosition(new Vector2(80, 300));
                    itemBrowser.Visible = false;

                    npcBrowser = new NPCBrowser(this);
                    npcBrowser.SetDefaultPosition(new Vector2(30, 180));
                    npcBrowser.Visible = false;

                    recipeBrowser = new RecipeBrowserWindow(this);
                    recipeBrowser.SetDefaultPosition(new Vector2(30, 180));
                    recipeBrowser.Visible = false;

                    extendedCheatMenu = new ExtendedCheatMenu(this);
                    extendedCheatMenu.SetDefaultPosition(new Vector2(120, 180));
                    extendedCheatMenu.Visible = false;

                    paintToolsHotbar = new PaintToolsHotbar(this);
                    //	paintToolsHotbar.SetDefaultPosition(new Microsoft.Xna.Framework.Vector2(120, 180));
                    paintToolsHotbar.Visible = false;
                    paintToolsHotbar.Hide();

                    paintToolsUI = new PaintToolsUI(this);
                    paintToolsUI.SetDefaultPosition(new Vector2(30, 180));
                    paintToolsUI.Visible = false;

                    quickTeleportHotbar         = new QuickTeleportHotbar(this);
                    quickTeleportHotbar.Visible = false;
                    quickTeleportHotbar.Hide();

                    quickClearHotbar         = new QuickClearHotbar(this);
                    quickClearHotbar.Visible = false;
                    quickClearHotbar.Hide();

                    npcButchererHotbar         = new NPCButchererHotbar(this);
                    npcButchererHotbar.Visible = false;
                    npcButchererHotbar.Hide();

                    //eventManagerHotbar = new EventManagerHotbar(this);
                    //eventManagerHotbar.Visible = false;
                    //eventManagerHotbar.Hide();

                    hotbar = new Hotbar(this);
                    //hotbar.Position = new Microsoft.Xna.Framework.Vector2(120, 180);
                    hotbar.Visible = true;
                    hotbar.Hide();
                }
                catch (Exception e)
                {
                    ErrorLogger.Log(e.ToString());
                }
            }
        }
示例#2
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            CheatSheetMessageType msgType = (CheatSheetMessageType)reader.ReadByte();
            string key;

            switch (msgType)
            {
            case CheatSheetMessageType.SpawnNPC:
                int npcType = reader.ReadInt32();
                int netID   = reader.ReadInt32();
                NPCSlot.HandleNPC(npcType, netID, true, whoAmI);
                key = "Mods.CheatSheet.MobBrowser.SpawnNPCNotification";
                NetMessage.BroadcastChatMessage(NetworkText.FromKey(key, netID, Netplay.Clients[whoAmI].Name), Color.Azure);
                //message = "Spawned " + netID + " by " + Netplay.Clients[whoAmI].Name;
                //NetMessage.SendData(25, -1, -1, message, 255, Color.Azure.R, Color.Azure.G, Color.Azure.B, 0);
                break;

            case CheatSheetMessageType.QuickClear:
                int clearType = reader.ReadInt32();
                switch (clearType)
                {
                case 0:
                    key = "Mods.CheatSheet.QuickClear.ItemClearNotification";
                    //message = "Items were cleared by ";
                    break;

                case 1:
                    key = "Mods.CheatSheet.QuickClear.ProjectileClearNotification";
                    //message = "Projectiles were cleared by ";
                    break;

                default:
                    key = "";
                    break;
                }
                //message += Netplay.Clients[whoAmI].Name;
                QuickClearHotbar.HandleQuickClear(clearType, true, whoAmI);
                NetMessage.BroadcastChatMessage(NetworkText.FromKey(key, Netplay.Clients[whoAmI].Name), Color.Azure);
                //NetMessage.SendData(25, -1, -1, message, 255, Color.Azure.R, Color.Azure.G, Color.Azure.B, 0);
                break;

            case CheatSheetMessageType.VacuumItems:
                Hotbar.HandleVacuum(true, whoAmI);
                key = "Mods.CheatSheet.Vacuum.VacuumNotification";
                NetMessage.BroadcastChatMessage(NetworkText.FromKey(key, Netplay.Clients[whoAmI].Name), Color.Azure);
                //message = "Items on the ground were vacuumed by " + Netplay.Clients[whoAmI].Name;
                //NetMessage.SendData(25, -1, -1, message, 255, Color.Azure.R, Color.Azure.G, Color.Azure.B, 0);
                break;

            case CheatSheetMessageType.ButcherNPCs:
                NPCButchererHotbar.HandleButcher(reader.ReadInt32(), true);
                key = "Mods.CheatSheet.Butcherer.ButcherNotification";
                NetMessage.BroadcastChatMessage(NetworkText.FromKey(key, Netplay.Clients[whoAmI].Name), Color.Azure);
                //message = "NPCs were butchered by " + Netplay.Clients[whoAmI].Name;
                //NetMessage.SendData(25, -1, -1, message, 255, Color.Azure.R, Color.Azure.G, Color.Azure.B, 0);
                break;

            case CheatSheetMessageType.TeleportPlayer:
                QuickTeleportHotbar.HandleTeleport(reader.ReadInt32(), true, whoAmI);
                break;

            case CheatSheetMessageType.SetSpawnRate:
                SpawnRateMultiplier.HandleSetSpawnRate(reader, whoAmI);
                break;

            case CheatSheetMessageType.SpawnRateSet:
                SpawnRateMultiplier.HandleSpawnRateSet(reader, whoAmI);
                break;

            case CheatSheetMessageType.RequestFilterNPC:
                int  netID2  = reader.ReadInt32();
                bool desired = reader.ReadBoolean();
                NPCBrowser.FilterNPC(netID2, desired);
                ConfigurationLoader.SaveSetting();

                var packet = GetPacket();
                packet.Write((byte)CheatSheetMessageType.InformFilterNPC);
                packet.Write(netID2);
                packet.Write(desired);
                packet.Send();
                break;

            case CheatSheetMessageType.InformFilterNPC:
                int  netID3   = reader.ReadInt32();
                bool desired2 = reader.ReadBoolean();
                NPCBrowser.FilterNPC(netID3, desired2);
                NPCBrowser.needsUpdate = true;
                break;

            //case CheatSheetMessageType.RequestToggleNPCSpawn:
            //	NPCSlot.HandleFilterRequest(reader.ReadInt32(), reader.ReadInt32(), true);
            //	break;
            default:
                Logger.Warn("Unknown Message type: " + msgType);
                break;
            }
        }