Beispiel #1
0
        public static void HandleSaveProjectile(int index, ref byte[] data)
        {
            int        ProjectileNum;
            ByteStream buffer = new ByteStream(data);

            if (S_Players.GetPlayerAccess(index) < (byte)Enums.AdminType.Developer)
            {
                return;
            }

            ProjectileNum = buffer.ReadInt32();

            // Prevent hacking
            if (ProjectileNum < 0 || ProjectileNum > MAX_PROJECTILES)
            {
                return;
            }

            Projectiles[ProjectileNum].Name   = buffer.ReadString();
            Projectiles[ProjectileNum].Sprite = buffer.ReadInt32();
            Projectiles[ProjectileNum].Range  = (byte)buffer.ReadInt32();
            Projectiles[ProjectileNum].Speed  = buffer.ReadInt32();
            Projectiles[ProjectileNum].Damage = buffer.ReadInt32();

            // Save it
            SendUpdateProjectileToAll(ProjectileNum);
            SaveProjectile(ProjectileNum);
            modDatabase.Addlog(S_Players.GetPlayerLogin(index) + " saved Projectile #" + ProjectileNum + ".", S_Constants.ADMIN_LOG);
            buffer.Dispose();
        }
Beispiel #2
0
 public static void Packet_SaveHouses(int index, ref byte[] data)
 {
     checked
     {
         if (!(S_Players.GetPlayerAccess(index) < 2))
         {
             ByteStream buffer = new ByteStream(data);
             int        Count  = buffer.ReadInt32();
             if (Count > 0)
             {
                 int num = Count;
                 for (int z = 1; z <= num; z++)
                 {
                     int i = buffer.ReadInt32();
                     S_Housing.HouseConfig[i].ConfigName   = (buffer.ReadString().Trim());
                     S_Housing.HouseConfig[i].BaseMap      = buffer.ReadInt32();
                     S_Housing.HouseConfig[i].X            = buffer.ReadInt32();
                     S_Housing.HouseConfig[i].Y            = buffer.ReadInt32();
                     S_Housing.HouseConfig[i].Price        = buffer.ReadInt32();
                     S_Housing.HouseConfig[i].MaxFurniture = buffer.ReadInt32();
                     S_Housing.SaveHouse(i);
                     int playersOnline = S_GameLogic.GetPlayersOnline();
                     for (int x = 1; x <= playersOnline; x++)
                     {
                         if (S_NetworkConfig.IsPlaying(x) && modTypes.Player[x].Character[(int)modTypes.TempPlayer[x].CurChar].InHouse == i)
                         {
                             S_Housing.SendFurnitureToHouse(i);
                         }
                     }
                 }
             }
             buffer.Dispose();
         }
     }
 }
Beispiel #3
0
        // Token: 0x060001DF RID: 479 RVA: 0x0003B69C File Offset: 0x0003989C
        public static void Packet_RequestEditHouse(int index, ref byte[] data)
        {
            bool flag = S_Players.GetPlayerAccess(index) < 2;

            checked
            {
                if (!flag)
                {
                    ByteStream buffer = new ByteStream(4);
                    buffer.WriteInt32(93);
                    int max_HOUSES = S_Housing.MAX_HOUSES;
                    for (int i = 1; i <= max_HOUSES; i++)
                    {
                        buffer.WriteString((S_Housing.HouseConfig[i].ConfigName.Trim()));
                        buffer.WriteInt32(S_Housing.HouseConfig[i].BaseMap);
                        buffer.WriteInt32(S_Housing.HouseConfig[i].X);
                        buffer.WriteInt32(S_Housing.HouseConfig[i].Y);
                        buffer.WriteInt32(S_Housing.HouseConfig[i].Price);
                        buffer.WriteInt32(S_Housing.HouseConfig[i].MaxFurniture);
                    }
                    S_NetworkConfig.Socket.SendDataTo(index, buffer.Data, buffer.Head);
                    buffer.Dispose();
                }
            }
        }
Beispiel #4
0
        internal static void ResetQuest(int index, int QuestNum)
        {
            if (S_Players.GetPlayerAccess(index) > 0)
            {
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].Status       = (byte)Enums.QuestStatusType.NotStarted;
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask   = 1;
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = 0;

                SendPlayerQuests(index);
                S_NetworkSend.PlayerMsg(index, "Quest " + QuestNum + " reset!", (int)Enums.ColorType.BrightRed);
            }
        }
Beispiel #5
0
        public static void Packet_RequestEditQuest(int index, ref byte[] data)
        {
            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (byte)Enums.AdminType.Developer)
            {
                return;
            }

            var Buffer = new ByteStream(4);

            Buffer.WriteInt32((byte)Packets.ServerPackets.SQuestEditor);
            S_NetworkConfig.Socket.SendDataTo(index, Buffer.Data, Buffer.Head);
            Buffer.Dispose();
        }
Beispiel #6
0
        public static void HandleRequestEditProjectiles(int index, ref byte[] data)
        {
            ByteStream buffer = new ByteStream(4);

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (byte)Enums.AdminType.Developer)
            {
                return;
            }

            buffer.WriteInt32((byte)Packets.ServerPackets.SProjectileEditor);

            S_NetworkConfig.Socket.SendDataTo(index, buffer.Data, buffer.Head);
            buffer.Dispose();
        }
        public static void Packet_EditAnimation(int index, ref byte[] data)
        {
            S_General.AddDebug("Recieved EMSG: RequestEditAnimation");

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (int)Enums.AdminType.Developer)
            {
                return;
            }

            var Buffer = new ByteStream(4);

            Buffer.WriteInt32((int)Packets.ServerPackets.SAnimationEditor);
            S_NetworkConfig.Socket.SendDataTo(index, Buffer.Data, Buffer.Head);
            Buffer.Dispose();
        }
Beispiel #8
0
        public static void Packet_QuestReset(int index, ref byte[] data)
        {
            int QuestNum;

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (byte)Enums.AdminType.Mapper)
            {
                return;
            }
            ByteStream buffer = new ByteStream(data);

            QuestNum = buffer.ReadInt32();

            ResetQuest(index, QuestNum);

            buffer.Dispose();
        }
        public static void Packet_SaveResource(int index, ref byte[] data)
        {
            int        resourcenum;
            ByteStream buffer = new ByteStream(data);

            S_General.AddDebug("Recieved EMSG: SaveResource");

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (int)Enums.AdminType.Developer)
            {
                return;
            }

            resourcenum = buffer.ReadInt32();

            // Prevent hacking
            if (resourcenum <= 0 || resourcenum > Constants.MAX_RESOURCES)
            {
                return;
            }

            Types.Resource[resourcenum].Animation      = buffer.ReadInt32();
            Types.Resource[resourcenum].EmptyMessage   = buffer.ReadString();
            Types.Resource[resourcenum].ExhaustedImage = buffer.ReadInt32();
            Types.Resource[resourcenum].Health         = buffer.ReadInt32();
            Types.Resource[resourcenum].ExpReward      = buffer.ReadInt32();
            Types.Resource[resourcenum].ItemReward     = buffer.ReadInt32();
            Types.Resource[resourcenum].Name           = buffer.ReadString();
            Types.Resource[resourcenum].ResourceImage  = buffer.ReadInt32();
            Types.Resource[resourcenum].ResourceType   = buffer.ReadInt32();
            Types.Resource[resourcenum].RespawnTime    = buffer.ReadInt32();
            Types.Resource[resourcenum].SuccessMessage = buffer.ReadString();
            Types.Resource[resourcenum].LvlRequired    = buffer.ReadInt32();
            Types.Resource[resourcenum].ToolRequired   = buffer.ReadInt32();
            Types.Resource[resourcenum].Walkthrough    = Convert.ToBoolean(buffer.ReadInt32());

            // Save it
            SendUpdateResourceToAll(resourcenum);
            SaveResource(resourcenum);

            modDatabase.Addlog(S_Players.GetPlayerLogin(index) + " saved Resource #" + resourcenum + ".", S_Constants.ADMIN_LOG);

            buffer.Dispose();
        }
Beispiel #10
0
        public static void Packet_PlayerHandleQuest(int index, ref byte[] data)
        {
            int        QuestNum;
            int        Order; // , I As Integer
            ByteStream buffer = new ByteStream(data);

            QuestNum = buffer.ReadInt32();
            Order    = buffer.ReadInt32(); // 1 = accept, 2 = cancel

            if (Order == 1)
            {
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].Status       = (byte)Enums.QuestStatusType.Started; // 1
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask   = 1;
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = 0;
                S_NetworkSend.PlayerMsg(index, "New quest accepted: " + Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Name) + "!", (int)Enums.ColorType.BrightGreen);
            }
            else if (Order == 2)
            {
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].Status       = (byte)Enums.QuestStatusType.NotStarted; // 2
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask   = 1;
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = 0;

                S_NetworkSend.PlayerMsg(index, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Name) + " has been canceled!", (int)Enums.ColorType.BrightRed);

                if (S_Players.GetPlayerAccess(index) > 0 && QuestNum == 1)
                {
                    for (var I = 1; I <= MAX_QUESTS; I++)
                    {
                        modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[I].Status       = (byte)Enums.QuestStatusType.NotStarted; // 2
                        modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[I].ActualTask   = 1;
                        modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[I].CurrentCount = 0;
                    }
                }
            }

            modDatabase.SavePlayer(index);
            S_NetworkSend.SendPlayerData(index);
            SendPlayerQuests(index);
            buffer.Dispose();
        }
Beispiel #11
0
        public static void Packet_SaveRecipe(int index, ref byte[] data)
        {
            int n;

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (int)Enums.AdminType.Developer)
            {
                return;
            }
            ByteStream buffer = new ByteStream(data);

            S_General.AddDebug("Recieved EMSG: SaveRecipe");

            // recipe index
            n = buffer.ReadInt32();

            // Update the Recipe
            Recipe[n].Name           = buffer.ReadString();
            Recipe[n].RecipeType     = (byte)buffer.ReadInt32();
            Recipe[n].MakeItemNum    = buffer.ReadInt32();
            Recipe[n].MakeItemAmount = buffer.ReadInt32();

            for (var i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                Recipe[n].Ingredients[i].ItemNum = buffer.ReadInt32();
                Recipe[n].Ingredients[i].Value   = buffer.ReadInt32();
            }

            Recipe[n].CreateTime = (byte)buffer.ReadInt32();

            // save
            SaveRecipe(n);

            // send to all
            SendUpdateRecipeToAll(n);

            buffer.Dispose();
        }
Beispiel #12
0
        public static void Packet_SaveQuest(int index, ref byte[] data)
        {
            int        QuestNum;
            ByteStream buffer = new ByteStream(data);

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (byte)Enums.AdminType.Developer)
            {
                return;
            }

            QuestNum = buffer.ReadInt32();
            if (QuestNum < 0 || QuestNum > MAX_QUESTS)
            {
                return;
            }

            // Update the Quest
            Quest[QuestNum].Name       = buffer.ReadString();
            Quest[QuestNum].QuestLog   = buffer.ReadString();
            Quest[QuestNum].Repeat     = (byte)buffer.ReadInt32();
            Quest[QuestNum].Cancelable = (byte)buffer.ReadInt32();

            Quest[QuestNum].ReqCount         = buffer.ReadInt32();
            Quest[QuestNum].Requirement      = new int[Quest[QuestNum].ReqCount + 1];
            Quest[QuestNum].RequirementIndex = new int[Quest[QuestNum].ReqCount + 1];
            var loopTo = Quest[QuestNum].ReqCount;

            for (var I = 1; I <= loopTo; I++)
            {
                Quest[QuestNum].Requirement[I]      = buffer.ReadInt32();
                Quest[QuestNum].RequirementIndex[I] = buffer.ReadInt32();
            }

            Quest[QuestNum].QuestGiveItem        = buffer.ReadInt32();
            Quest[QuestNum].QuestGiveItemValue   = buffer.ReadInt32();
            Quest[QuestNum].QuestRemoveItem      = buffer.ReadInt32();
            Quest[QuestNum].QuestRemoveItemValue = buffer.ReadInt32();

            for (var I = 1; I <= 3; I++)
            {
                Quest[QuestNum].Chat[I] = buffer.ReadString();
            }

            Quest[QuestNum].RewardCount      = buffer.ReadInt32();
            Quest[QuestNum].RewardItem       = new int[Quest[QuestNum].RewardCount + 1];
            Quest[QuestNum].RewardItemAmount = new int[Quest[QuestNum].RewardCount + 1];
            var loopTo1 = Quest[QuestNum].RewardCount;

            for (var i = 1; i <= loopTo1; i++)
            {
                Quest[QuestNum].RewardItem[i]       = buffer.ReadInt32();
                Quest[QuestNum].RewardItemAmount[i] = buffer.ReadInt32();
            }

            Quest[QuestNum].RewardExp = buffer.ReadInt32();

            Quest[QuestNum].TaskCount = buffer.ReadInt32();
            Quest[QuestNum].Task      = new TaskRec[Quest[QuestNum].TaskCount + 1];
            var loopTo2 = Quest[QuestNum].TaskCount;

            for (var I = 1; I <= loopTo2; I++)
            {
                Quest[QuestNum].Task[I].Order    = buffer.ReadInt32();
                Quest[QuestNum].Task[I].NPC      = buffer.ReadInt32();
                Quest[QuestNum].Task[I].Item     = buffer.ReadInt32();
                Quest[QuestNum].Task[I].Map      = buffer.ReadInt32();
                Quest[QuestNum].Task[I].Resource = buffer.ReadInt32();
                Quest[QuestNum].Task[I].Amount   = buffer.ReadInt32();
                Quest[QuestNum].Task[I].Speech   = buffer.ReadString();
                Quest[QuestNum].Task[I].TaskLog  = buffer.ReadString();
                Quest[QuestNum].Task[I].QuestEnd = (byte)buffer.ReadInt32();
                Quest[QuestNum].Task[I].TaskType = buffer.ReadInt32();
            }

            buffer.Dispose();

            // Save it
            SendQuests(index);              // editor
            SendUpdateQuestToAll(QuestNum); // players
            SaveQuest(QuestNum);
            modDatabase.Addlog(S_Players.GetPlayerLogin(index) + " saved Quest #" + QuestNum + ".", S_Constants.ADMIN_LOG);
        }
Beispiel #13
0
        public static void Packet_SaveItem(int index, ref byte[] data)
        {
            int        n;
            ByteStream buffer = new ByteStream(data);

            S_General.AddDebug("Recieved EMSG: SaveItem");

            // Prevent hacking
            if (S_Players.GetPlayerAccess(index) < (int)Enums.AdminType.Developer)
            {
                return;
            }

            n = buffer.ReadInt32();

            if (n < 0 || n > Constants.MAX_ITEMS)
            {
                return;
            }

            // Update the item
            Types.Item[n].AccessReq = buffer.ReadInt32();

            for (var i = 0; i <= (int)Enums.StatType.Count - 1; i++)
            {
                Types.Item[n].Add_Stat[i] = (byte)buffer.ReadInt32();
            }

            Types.Item[n].Animation = buffer.ReadInt32();
            Types.Item[n].BindType  = (byte)buffer.ReadInt32();
            Types.Item[n].ClassReq  = buffer.ReadInt32();
            Types.Item[n].Data1     = buffer.ReadInt32();
            Types.Item[n].Data2     = buffer.ReadInt32();
            Types.Item[n].Data3     = buffer.ReadInt32();
            Types.Item[n].TwoHanded = buffer.ReadInt32();
            Types.Item[n].LevelReq  = buffer.ReadInt32();
            Types.Item[n].Mastery   = (byte)buffer.ReadInt32();
            Types.Item[n].Name      = Microsoft.VisualBasic.Strings.Trim(buffer.ReadString());
            Types.Item[n].Paperdoll = buffer.ReadInt32();
            Types.Item[n].Pic       = buffer.ReadInt32();
            Types.Item[n].Price     = buffer.ReadInt32();
            Types.Item[n].Rarity    = (byte)buffer.ReadInt32();
            Types.Item[n].Speed     = buffer.ReadInt32();

            Types.Item[n].Randomize = (byte)buffer.ReadInt32();
            Types.Item[n].RandomMin = (byte)buffer.ReadInt32();
            Types.Item[n].RandomMax = (byte)buffer.ReadInt32();

            Types.Item[n].Stackable   = (byte)buffer.ReadInt32();
            Types.Item[n].Description = Microsoft.VisualBasic.Strings.Trim(buffer.ReadString());

            for (var i = 0; i <= (int)Enums.StatType.Count - 1; i++)
            {
                Types.Item[n].Stat_Req[i] = (byte)buffer.ReadInt32();
            }

            Types.Item[n].Type    = (byte)buffer.ReadInt32();
            Types.Item[n].SubType = (byte)buffer.ReadInt32();

            Types.Item[n].ItemLevel = (byte)buffer.ReadInt32();

            // Housing
            Types.Item[n].FurnitureWidth  = buffer.ReadInt32();
            Types.Item[n].FurnitureHeight = buffer.ReadInt32();

            for (var a = 0; a <= 3; a++)
            {
                for (var b = 0; b <= 3; b++)
                {
                    Types.Item[n].FurnitureBlocks[a, b] = buffer.ReadInt32();
                    Types.Item[n].FurnitureFringe[a, b] = buffer.ReadInt32();
                }
            }

            Types.Item[n].KnockBack      = (byte)buffer.ReadInt32();
            Types.Item[n].KnockBackTiles = (byte)buffer.ReadInt32();

            Types.Item[n].Projectile = buffer.ReadInt32();
            Types.Item[n].Ammo       = buffer.ReadInt32();

            // Save it
            SendUpdateItemToAll(n);
            SaveItem(n);
            modDatabase.Addlog(S_Players.GetPlayerLogin(index) + " saved item #" + n + ".", S_Constants.ADMIN_LOG);
            buffer.Dispose();
        }
Beispiel #14
0
        public static void Packet_PlaceFurniture(int index, ref byte[] data)
        {
            ByteStream buffer  = new ByteStream(data);
            int        x       = buffer.ReadInt32();
            int        y       = buffer.ReadInt32();
            int        invslot = buffer.ReadInt32();

            buffer.Dispose();
            int ItemNum = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].Inv[invslot].Num;

            checked
            {
                if (!(ItemNum < 1 || ItemNum > 500))
                {
                    if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse == index)
                    {
                        if (Types.Item[ItemNum].Type == 6)
                        {
                            int i = 1;
                            for (; ;)
                            {
                                if (S_Players.GetPlayerRawStat(index, (Enums.StatType)i) < (int)Types.Item[ItemNum].Stat_Req[i])
                                {
                                    break;
                                }
                                i++;
                                if (i > 6)
                                {
                                    goto Block_6;
                                }
                            }
                            S_NetworkSend.PlayerMsg(index, "You do not meet the stat requirements to use this item.", 12);
                            return;

Block_6:
                            if (S_Players.GetPlayerLevel(index) < Types.Item[ItemNum].LevelReq)
                            {
                                S_NetworkSend.PlayerMsg(index, "You do not meet the level requirement to use this item.", 12);
                            }
                            else
                            {
                                if (Types.Item[ItemNum].ClassReq > 0)
                                {
                                    if (S_Players.GetPlayerClass(index) != Types.Item[ItemNum].ClassReq)
                                    {
                                        S_NetworkSend.PlayerMsg(index, "You do not meet the class requirement to use this item.", 12);
                                        return;
                                    }
                                }
                                if (S_Players.GetPlayerAccess(index) < Types.Item[ItemNum].AccessReq)
                                {
                                    S_NetworkSend.PlayerMsg(index, "You do not meet the access requirement to use this item.", 12);
                                }
                                else
                                {
                                    if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse != index)
                                    {
                                        S_NetworkSend.PlayerMsg(index, "You must be inside your house to place furniture!", 14);
                                    }
                                    else
                                    {
                                        if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount >= S_Housing.HouseConfig[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Houseindex].MaxFurniture)
                                        {
                                            if (S_Housing.HouseConfig[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Houseindex].MaxFurniture > 0)
                                            {
                                                S_NetworkSend.PlayerMsg(index, "Your house cannot hold any more furniture!", 12);
                                                return;
                                            }
                                        }
                                        if (!(x < 0 || x > (int)modTypes.Map[S_Players.GetPlayerMap(index)].MaxX))
                                        {
                                            if (!(y < 0 || y > (int)modTypes.Map[S_Players.GetPlayerMap(index)].MaxY))
                                            {
                                                int x2;
                                                int widthoffset;
                                                if (Types.Item[ItemNum].FurnitureWidth > 2)
                                                {
                                                    x2          = (int)Math.Round(unchecked ((double)x + (double)Types.Item[ItemNum].FurnitureWidth / 2.0));
                                                    widthoffset = x2 - x;
                                                    x2         -= Types.Item[ItemNum].FurnitureWidth - widthoffset;
                                                }
                                                x2          = x;
                                                widthoffset = 0;
                                                int y2 = y;
                                                if (widthoffset > 0)
                                                {
                                                    int num  = x2;
                                                    int num2 = x2 + widthoffset;
                                                    for (x = num; x <= num2; x++)
                                                    {
                                                        int num3 = y2;
                                                        int num4 = y2 - Types.Item[ItemNum].FurnitureHeight + 1;
                                                        for (y = num3; y >= num4; y += -1)
                                                        {
                                                            if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1)
                                                            {
                                                                return;
                                                            }
                                                            int playersOnline = S_GameLogic.GetPlayersOnline();
                                                            for (i = 1; i <= playersOnline; i++)
                                                            {
                                                                if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index))
                                                                {
                                                                    if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse)
                                                                    {
                                                                        if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0)
                                                            {
                                                                int furnitureCount = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount;
                                                                for (i = 1; i <= furnitureCount; i++)
                                                                {
                                                                    if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1)
                                                                    {
                                                                        if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    int num5 = x2;
                                                    int num6 = x2 - (Types.Item[ItemNum].FurnitureWidth - widthoffset);
                                                    for (x = num5; x >= num6; x += -1)
                                                    {
                                                        int num7 = y2;
                                                        int num8 = y2 - Types.Item[ItemNum].FurnitureHeight + 1;
                                                        for (y = num7; y >= num8; y += -1)
                                                        {
                                                            if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1)
                                                            {
                                                                return;
                                                            }
                                                            int playersOnline2 = S_GameLogic.GetPlayersOnline();
                                                            for (i = 1; i <= playersOnline2; i++)
                                                            {
                                                                if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index))
                                                                {
                                                                    if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse)
                                                                    {
                                                                        if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0)
                                                            {
                                                                int furnitureCount2 = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount;
                                                                for (i = 1; i <= furnitureCount2; i++)
                                                                {
                                                                    if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1)
                                                                    {
                                                                        if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    int num9  = x2;
                                                    int num10 = x2 + Types.Item[ItemNum].FurnitureWidth - 1;
                                                    for (x = num9; x <= num10; x++)
                                                    {
                                                        int num11 = y2;
                                                        int num12 = y2 - Types.Item[ItemNum].FurnitureHeight + 1;
                                                        for (y = num11; y >= num12; y += -1)
                                                        {
                                                            if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1)
                                                            {
                                                                return;
                                                            }
                                                            int playersOnline3 = S_GameLogic.GetPlayersOnline();
                                                            for (i = 1; i <= playersOnline3; i++)
                                                            {
                                                                if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index))
                                                                {
                                                                    if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse)
                                                                    {
                                                                        if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0)
                                                            {
                                                                int furnitureCount3 = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount;
                                                                for (i = 1; i <= furnitureCount3; i++)
                                                                {
                                                                    if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1)
                                                                    {
                                                                        if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1)
                                                                        {
                                                                            return;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                x = x2;
                                                y = y2;
                                                modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount + 1;
                                                modTypes.CharacterRec[] character = modTypes.Player[index].Character;
                                                byte curChar = modTypes.TempPlayer[index].CurChar;
                                                character[(int)curChar].House.Furniture = (S_Housing.FurnitureRec[])Utils.CopyArray(character[(int)curChar].House.Furniture, new S_Housing.FurnitureRec[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount + 1]);
                                                modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].ItemNum = ItemNum;
                                                modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].X       = x;
                                                modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].Y       = y;
                                                S_Players.TakeInvItem(index, ItemNum, 0);
                                                S_Housing.SendFurnitureToHouse(modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse);
                                                modDatabase.SavePlayer(index);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        S_NetworkSend.PlayerMsg(index, "You cannot place furniture unless you are in your own house!", 12);
                    }
                }
            }
        }