Example #1
0
    public static void SoltarItem(byte Index, byte Slot)
    {
        short Map_Num = Character(Index).Map;

        Lists.Structures.Map_Items Map_Item = new Lists.Structures.Map_Items();

        // Somente se necessário
        if (Lists.Map[Map_Num].Temp_Item.Count == Game.Max_Map_Items)
        {
            return;
        }
        if (Character(Index).Inventory[Slot].Item_Num == 0)
        {
            return;
        }
        if (Lists.Item[Character(Index).Inventory[Slot].Item_Num].NãoDropável)
        {
            return;
        }

        // Solta o item no chão
        Map_Item.Index  = Character(Index).Inventory[Slot].Item_Num;
        Map_Item.Amount = Character(Index).Inventory[Slot].Amount;
        Map_Item.X      = Character(Index).X;
        Map_Item.Y      = Character(Index).Y;
        Lists.Map[Map_Num].Temp_Item.Add(Map_Item);
        Sending.Map_Items(Map_Num);

        // Retira o item do Inventory do jogador
        Character(Index).Inventory[Slot].Item_Num = 0;
        Character(Index).Inventory[Slot].Amount   = 0;
        Sending.Player_Inventory(Index);
    }
Example #2
0
File: NPC.cs Project: Kukks/CryBits
    public static void Died(short Map_Num, byte Index)
    {
        Lists.Structures.NPC NPC = Lists.NPC[Lists.Temp_Map[Map_Num].NPC[Index].Index];

        // Solta os itens
        for (byte i = 0; i < NPC.Drop.Length; i++)
        {
            if (NPC.Drop[i].Item_Num > 0)
            {
                if (Game.Random.Next(NPC.Drop[i].Chance, 101) == 100)
                {
                    // Dados do item
                    Lists.Structures.Map_Items Item = new Lists.Structures.Map_Items();
                    Item.Index  = NPC.Drop[i].Item_Num;
                    Item.Amount = NPC.Drop[i].Amount;
                    Item.X      = Lists.Temp_Map[Map_Num].NPC[Index].X;
                    Item.Y      = Lists.Temp_Map[Map_Num].NPC[Index].Y;

                    // Solta
                    Lists.Temp_Map[Map_Num].Item.Add(Item);
                }
            }
        }

        // Envia os dados dos itens no chão para o mapa
        Send.Map_Items(Map_Num);

        // Reseta os dados do NPC
        Lists.Temp_Map[Map_Num].NPC[Index].Vital[(byte)Game.Vitals.HP] = 0;
        Lists.Temp_Map[Map_Num].NPC[Index].Spawn_Timer  = Environment.TickCount;
        Lists.Temp_Map[Map_Num].NPC[Index].Index        = 0;
        Lists.Temp_Map[Map_Num].NPC[Index].Target_Type  = 0;
        Lists.Temp_Map[Map_Num].NPC[Index].Target_Index = 0;
        Send.Map_NPC_Died(Map_Num, Index);
    }
Example #3
0
    public static void Died(short Map_Num, byte Index)
    {
        Lists.Structures.NPCs NPC = Lists.NPC[Lists.Map[Map_Num].Temp_NPC[Index].Index];

        // Solta os itens
        for (byte i = 0; i <= Game.Max_NPC_Queda - 1; i++)
        {
            if (NPC.Queda[i].Item_Num > 0)
            {
                if (Game.Aleatório.Next(NPC.Queda[i].Chance, 101) == 100)
                {
                    // Data do item
                    Lists.Structures.Map_Items Item = new Lists.Structures.Map_Items();
                    Item.Index  = NPC.Queda[i].Item_Num;
                    Item.Amount = NPC.Queda[i].Amount;
                    Item.X      = Lists.Map[Map_Num].Temp_NPC[Index].X;
                    Item.Y      = Lists.Map[Map_Num].Temp_NPC[Index].Y;

                    // Solta
                    Lists.Map[Map_Num].Temp_Item.Add(Item);
                }
            }
        }

        // Envia os Data dos itens no chão para o mapa
        Sending.Map_Items(Map_Num);

        // Reseta os Data do NPC
        Lists.Map[Map_Num].Temp_NPC[Index].Vital[(byte)Game.Vital.Life] = 0;
        Lists.Map[Map_Num].Temp_NPC[Index].Appearance_Time = Environment.TickCount;
        Lists.Map[Map_Num].Temp_NPC[Index].Index           = 0;
        Lists.Map[Map_Num].Temp_NPC[Index].Target_Type     = 0;
        Lists.Map[Map_Num].Temp_NPC[Index].Target_Index    = 0;
        Sending.Map_NPC_Died(Map_Num, Index);
    }
Example #4
0
    private static void Equipment_Remove(byte Index, NetIncomingMessage Data)
    {
        byte  Slot    = Data.ReadByte();
        short Map_Num = Player.Character(Index).Map;

        Lists.Structures.Map_Items Map_Item = new Lists.Structures.Map_Items();

        // Apenas se necessário
        if (Player.Character(Index).Equipment[Slot] == 0)
        {
            return;
        }
        if (Lists.Item[Player.Character(Index).Equipment[Slot]].Bind == (byte)Game.BindOn.Equip)
        {
            return;
        }

        // Adiciona o equipamento ao inventário
        if (!Player.GiveItem(Index, Player.Character(Index).Equipment[Slot], 1))
        {
            // Somente se necessário
            if (Lists.Temp_Map[Map_Num].Item.Count == Lists.Server_Data.Max_Map_Items)
            {
                return;
            }

            // Solta o item no chão
            Map_Item.Index  = Player.Character(Index).Equipment[Slot];
            Map_Item.Amount = 1;
            Map_Item.X      = Player.Character(Index).X;
            Map_Item.Y      = Player.Character(Index).Y;
            Lists.Temp_Map[Map_Num].Item.Add(Map_Item);

            // Envia os dados
            Send.Map_Items(Map_Num);
            Send.Player_Inventory(Index);
        }

        // Remove o equipamento
        for (byte i = 0; i < (byte)Game.Attributes.Count; i++)
        {
            Player.Character(Index).Attribute[i] -= Lists.Item[Player.Character(Index).Equipment[Slot]].Equip_Attribute[i];
        }
        Player.Character(Index).Equipment[Slot] = 0;

        // Envia os dados
        Send.Player_Equipments(Index);
    }
Example #5
0
    private static void Remove_Equipment(byte Index, NetIncomingMessage Data)
    {
        byte  Slot       = Data.ReadByte();
        byte  Slot_Vazio = Player.EncontrarInventory(Index, 0);
        short Map_Num    = Player.Character(Index).Map;

        Lists.Structures.Map_Items Map_Item = new Lists.Structures.Map_Items();

        // Apenas se necessário
        if (Player.Character(Index).Equipment[Slot] == 0)
        {
            return;
        }

        // Adiciona o equipamento ao Inventory
        if (!Player.GiveItem(Index, Player.Character(Index).Equipment[Slot], 1))
        {
            // Somente se necessário
            if (Lists.Map[Map_Num].Temp_Item.Count == Game.Max_Map_Items)
            {
                return;
            }

            // Solta o item no chão
            Map_Item.Index  = Player.Character(Index).Equipment[Slot];
            Map_Item.Amount = 1;
            Map_Item.X      = Player.Character(Index).X;
            Map_Item.Y      = Player.Character(Index).Y;
            Lists.Map[Map_Num].Temp_Item.Add(Map_Item);

            // Envia os Data
            Sending.Map_Items(Map_Num);
            Sending.Player_Inventory(Index);
        }

        // Remove o equipamento
        for (byte i = 0; i <= (byte)Game.Attributes.Amount - 1; i++)
        {
            Player.Character(Index).Attribute[i] -= Lists.Item[Player.Character(Index).Equipment[Slot]].Equip_Attribute[i];
        }
        Player.Character(Index).Equipment[Slot] = 0;

        // Envia os Data
        Sending.Player_Equipment(Index);
    }
Example #6
0
    public static void Map_Items()
    {
        // Desenha todos osItems que estão no chão
        for (byte i = 1; i <= Lists.Map.Temp_Item.GetUpperBound(0); i++)
        {
            Lists.Structures.Map_Items Data = Lists.Map.Temp_Item[i];

            // Somente se necessário
            if (Data.Index == 0)
            {
                continue;
            }

            // Desenha o item
            Point Position = new Point(Jogo.ConvertX(Data.X * Jogo.Grade), Jogo.ConvertY(Data.Y * Jogo.Grade));
            Desenhar(Tex_Item[Lists.Item[Data.Index].Texture], Position);
        }
    }
Example #7
0
File: Map.cs Project: Kukks/CryBits
    private static void Map_Items()
    {
        // Desenha todos os itens que estão no chão
        for (byte i = 1; i < Lists.Temp_Map.Item.Length; i++)
        {
            Lists.Structures.Map_Items Data = Lists.Temp_Map.Item[i];

            // Somente se necessário
            if (Data.Index == 0)
            {
                continue;
            }

            // Desenha o item
            Point Position = new Point(Game.ConvertX(Data.X * Game.Grid), Game.ConvertY(Data.Y * Game.Grid));
            Render(Tex_Item[Lists.Item[Data.Index].Texture], Position);
        }
    }
Example #8
0
    public static void DropItem(byte Index, byte Slot, short Amount)
    {
        short Map_Num = Character(Index).Map;

        Lists.Structures.Map_Items Map_Item = new Lists.Structures.Map_Items();

        // Somente se necessário
        if (Lists.Temp_Map[Map_Num].Item.Count == Lists.Server_Data.Max_Map_Items)
        {
            return;
        }
        if (Character(Index).Inventory[Slot].Item_Num == 0)
        {
            return;
        }
        if (Lists.Item[Character(Index).Inventory[Slot].Item_Num].Bind == (byte)Game.BindOn.Pickup)
        {
            return;
        }

        // Verifica se não está dropando mais do que tem
        if (Amount > Character(Index).Inventory[Slot].Amount)
        {
            Amount = Character(Index).Inventory[Slot].Amount;
        }

        // Solta o item no chão
        Map_Item.Index  = Character(Index).Inventory[Slot].Item_Num;
        Map_Item.Amount = Amount;
        Map_Item.X      = Character(Index).X;
        Map_Item.Y      = Character(Index).Y;
        Lists.Temp_Map[Map_Num].Item.Add(Map_Item);
        Send.Map_Items(Map_Num);

        // Retira o item do inventário do jogador
        if (Amount == Character(Index).Inventory[Slot].Amount)
        {
            Character(Index).Inventory[Slot].Item_Num = 0;
        }
        Character(Index).Inventory[Slot].Amount = (short)(Character(Index).Inventory[Slot].Amount - Amount);
        Send.Player_Inventory(Index);
    }
Example #9
0
    public static void Appearance_Items(short Map_Num)
    {
        Lists.Structures.Maps      Data = Lists.Map[Map_Num];
        Lists.Structures.Map_Items Item = new Lists.Structures.Map_Items();

        // Verifica se tem algum atributo de item no Map
        for (byte x = 0; x <= Data.Width; x++)
        {
            for (byte y = 0; y <= Data.Height; y++)
            {
                if (Data.Tile[x, y].Attribute == (byte)Attributes.Item)
                {
                    // Faz o item aparecer
                    Item.Index  = Data.Tile[x, y].Dado_1;
                    Item.Amount = Data.Tile[x, y].Dado_2;
                    Item.X      = x;
                    Item.Y      = y;
                    Lists.Map[Map_Num].Temp_Item.Add(Item);
                }
            }
        }
    }