Exemplo n.º 1
0
        public void ParseEntry(String[] raw)
        {
            Int32 index = 0;

            Price      = CsvParser.UInt16(raw[index++]);
            GraphicsId = CsvParser.Byte(raw[index++]);
            ColorId    = CsvParser.Byte(raw[index++]);
            Quality    = CsvParser.Byte(raw[index++]);
            BonusId    = CsvParser.Byte(raw[index++]);
            AbilityIds = CsvParser.ByteArray(raw[index++]);

            Byte type = 0;

            for (Int32 i = 0; i < 8; i++)
            {
                type <<= 1;
                type  |= CsvParser.Byte(raw[index++]);
            }
            TypeMask = (ItemType)type;

            Order = CsvParser.Byte(raw[index++]);

            UInt16 equippable = 0;

            for (Int32 i = 0; i < 12; i++)
            {
                equippable <<= 1;
                equippable  |= CsvParser.Byte(raw[index++]);
            }

            CharacterMask = (ItemCharacter)equippable;
        }
 public MushroomBumping(ItemCharacter item, Vector2 startPos, float minY, float startHeight, Vector2 speed)
 {
     this.item        = item;
     this.minY        = minY;
     this.startHeight = startHeight;
     this.speed       = speed;
     this.startPos    = startPos;
 }
 public FlowerBumping(ItemCharacter item, Vector2 startPos, float minY, float startHeight, Vector2 speed)
 {
     this.item        = (FlowerCharacter)item;
     this.minY        = minY;
     this.startHeight = startHeight;
     this.speed       = speed;
     this.startPos    = startPos;
 }
Exemplo n.º 4
0
        public uint GetCharTypeID()
        {
            var CharInfo = ItemCharacter.GetChar(CharacterIndex, 0);

            if (!(CharInfo == null))
            {
                return(CharInfo.TypeID);
            }
            return(0);
        }
Exemplo n.º 5
0
        public CharacterData GetCharacter(uint TypeID)
        {
            var Character = ItemCharacter.GetChar(TypeID, 1);

            if (!(Character == null))
            {
                return(Character);
            }
            return(null);
        }
Exemplo n.º 6
0
        public uint GetCutinIndex()
        {
            var CharInfo = ItemCharacter.GetChar(CharacterIndex, 0);

            if (!(CharInfo == null))
            {
                return(CharInfo.CutinIndex);
            }
            return(0);
        }
Exemplo n.º 7
0
        public bool SetCharIndex(uint CharID)
        {
            var Char = ItemCharacter.GetChar(CharID, 0);

            if (Char == null)
            {
                return(false);
            }
            CharacterIndex = CharID;
            return(true);
        }
Exemplo n.º 8
0
        public PlayerCharacterData GetCharacter(uint TypeID)
        {
            PlayerCharacterData Character;

            Character = ItemCharacter.GetChar(TypeID, CharType.bTypeID);
            if (!(Character == null))
            {
                return(Character);
            }
            return(null);
        }
Exemplo n.º 9
0
        public uint GetCutinIndex()
        {
            PlayerCharacterData CharInfo;

            CharInfo = ItemCharacter.GetChar(CharacterIndex, CharType.bIndex);
            if (!(CharInfo == null))
            {
                return(CharInfo.FCutinIndex);
            }
            return(0);
        }
Exemplo n.º 10
0
        public override uint GetCharTypeID()
        {
            PlayerCharacterData CharInfo;

            CharInfo = ItemCharacter.GetChar(CharacterIndex, CharType.bIndex);
            if (!(CharInfo == null))
            {
                return(CharInfo.TypeID);
            }
            return(0);
        }
Exemplo n.º 11
0
        public bool SetCharIndex(uint CharID)
        {
            PlayerCharacterData Char;

            Char = ItemCharacter.GetChar(CharID, CharType.bIndex);
            if (Char == null)
            {
                return(false);
            }
            CharacterIndex = CharID;
            return(true);
        }
Exemplo n.º 12
0
        // poster


        public override bool SetCutInIndex(uint CharIndex, uint CutinIndex)
        {
            if (CutinIndex == 0)
            {
                return(true);
            }
            var Item     = ItemWarehouse.GetItem(CutinIndex, TGET_ITEM.gcIndex);
            var CharType = ItemCharacter.GetChar(CharIndex, Defines.CharType.bIndex);

            if (Item == null)
            {
                return(false);
            }
            if (CharType == null)
            {
                return(false);
            }
            CharType.FCutinIndex = Item.ItemIndex;
            ItemCharacter.UpdateCharacter(CharType);
            return(true);
        }
Exemplo n.º 13
0
        // poster


        public bool SetCutInIndex(uint CharIndex, uint CutinIndex)
        {
            if (CutinIndex == 0)
            {
                return(true);
            }
            var Item     = ItemWarehouse.GetItem(CutinIndex, 0);
            var CharType = ItemCharacter.GetChar(CharIndex, 0);

            if (Item == null)
            {
                return(false);
            }
            if (CharType == null)
            {
                return(false);
            }
            CharType.CutinIndex = Item.ItemIndex;
            ItemCharacter.UpdateCharacter(CharType);
            return(true);
        }
Exemplo n.º 14
0
        private void DiscloseItem()
        {
            ItemCharacter       item = (ItemCharacter)items[0];
            ItemBumpingCommands bumpItem;

            SoundFactory.Instance.BumpItems();
            if (item is RandomItemCharacter || item is JumpMedicineCharacter)
            {
                item.Bumping(bPosition, bPosition.Y, bPosition.Y, spriteSpeed);
            }
            else
            {
                switch (item.Type)
                {
                case Sprint5Main.CharacterType.Coin:
                    bumpItem = new CoinBumping(item, bPosition, bPosition.Y - 3.0f * this.GetHeightAndWidth.X, bPosition.Y, spriteSpeed);
                    bumpItem.HandleBumping();
                    break;

                case Sprint5Main.CharacterType.Flower:
                    bumpItem = new FlowerBumping(item, bPosition, bPosition.Y, bPosition.Y, spriteSpeed);
                    bumpItem.HandleBumping();
                    break;

                case Sprint5Main.CharacterType.RedMushroom:
                case Sprint5Main.CharacterType.GreenMushroom:
                    bumpItem = new MushroomBumping(item, bPosition, bPosition.Y - 1.0f * this.GetHeightAndWidth.X, bPosition.Y, spriteSpeed);
                    bumpItem.HandleBumping();
                    break;

                case Sprint5Main.CharacterType.Star:
                    bumpItem = new StarBumping(item, bPosition, bPosition.Y - 2.0f * this.GetHeightAndWidth.X, bPosition.Y, spriteSpeed);
                    bumpItem.HandleBumping();
                    break;
                }
            }
        }
Exemplo n.º 15
0
 public byte[] GetCharData()
 {
     return(ItemCharacter.GetCharData(CharacterIndex));
 }
Exemplo n.º 16
0
        // PlayerSave
        public void Save(PangyaEntities _db)
        {
            // # PLAYER TOOLBAR UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_TOOLBAR  @UID = '{UID}', @ITEMSTR = '{GetSqlUpdateToolbar()}'").FirstOrDefault();

            // #PLAYER ITEM UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_ITEM  @UID = '{UID}', @ITEMSTR = '{ItemWarehouse.GetSqlUpdateItems()}'").FirstOrDefault();

            // #PLAYER CADDIE UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CADDIE  @UID = '{UID}', @ITEMSTR = '{ItemCaddie.GetSqlUpdateCaddie()}'").FirstOrDefault();

            // #PLAYER CHARACTER AND EQUIP UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CHARACTER_EQUIP  @UID = '{UID}', @EQUIPSTR = '{ItemCharacter.GetSqlUpdateCharacter()}'").FirstOrDefault();

            // #PLAYER CARD UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CARD  @UID = '{UID}', @ITEMSTR = '{ItemCard.GetSqlUpdateCard()}'").FirstOrDefault();

            // #PLAYER CARD EQUIP UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_CARD_EQUIP  @UID = '{UID}', @ITEMSTR = '{ItemCardEquip.GetSqlUpdateCardEquip()}'").FirstOrDefault();

            // #PLAYER MASCOT UPDATE
            _db.Database.SqlQuery <PangyaEntities>($"Exec dbo.USP_SAVE_MASCOT  @UID = '{UID}', @ITEMSTR = '{ItemMascot.GetSqlUpdateMascots()}'").FirstOrDefault();

            _db.Dispose();
        }
Exemplo n.º 17
0
        public AddItemData AddItem(AddItem ItemAddItemData)
        {
            Object      WareHouseData;
            AddItemData Result;

            Result = new AddItemData()
            {
                Status = false
            };


            if (UID == 0)
            {
                return(Result);
            }
            switch (ItemAddItemData.ItemIffId.GetItemGroup())
            {
            case IffGroupFlag.ITEM_TYPE_CHARACTER:
            {
                WareHouseData = ItemCharacter.GetChar(ItemAddItemData.ItemIffId, 1);

                if (WareHouseData == null)
                {
                    return(AddItemToDB(ItemAddItemData));
                }

                else if (!(WareHouseData != null))
                {
                    Result.Status      = true;
                    Result.ItemIndex   = ((CharacterData)(WareHouseData)).Index;
                    Result.ItemTypeID  = ((CharacterData)(WareHouseData)).TypeID;
                    Result.ItemOldQty  = 1;
                    Result.ItemNewQty  = 1;
                    Result.ItemUCCKey  = string.Empty;
                    Result.ItemFlag    = 0;
                    Result.ItemEndDate = null;

                    if (ItemAddItemData.Transaction)
                    {
                        ItemTransaction.AddChar(2, (CharacterData)WareHouseData);
                    }
                }
            }
            break;

            case IffGroupFlag.ITEM_TYPE_HAIR_STYLE:
            {
                var IffHair   = IFFEntry.GetIff.GetByHairColor(ItemAddItemData.ItemIffId);
                var character = ItemCharacter.GetCharByType((byte)IffHair.CharType);
                if (character != null)
                {
                    character.HairColour = IffHair.HairColor;
                    character.Update(character);
                    Result.Status      = true;
                    Result.ItemIndex   = character.Index;
                    Result.ItemTypeID  = ItemAddItemData.ItemIffId;
                    Result.ItemOldQty  = 0;
                    Result.ItemNewQty  = 1;
                    Result.ItemUCCKey  = null;
                    Result.ItemFlag    = 0;
                    Result.ItemEndDate = null;
                }
            }
            break;

            case IffGroupFlag.ITEM_TYPE_PART:
            {
                return(AddItemToDB(ItemAddItemData));
            }

            case IffGroupFlag.ITEM_TYPE_CLUB:
            {
                return(AddItemToDB(ItemAddItemData));
            }

            case IffGroupFlag.ITEM_TYPE_AUX:
            case IffGroupFlag.ITEM_TYPE_BALL:
            case IffGroupFlag.ITEM_TYPE_USE:
            {
                WareHouseData = ItemWarehouse.GetItem(ItemAddItemData.ItemIffId, 1);
                if (WareHouseData != null)
                {
                    Result.Status      = true;
                    Result.ItemIndex   = ((WarehouseData)(WareHouseData)).ItemIndex;
                    Result.ItemTypeID  = ((WarehouseData)(WareHouseData)).ItemTypeID;
                    Result.ItemOldQty  = ((WarehouseData)(WareHouseData)).ItemC0;
                    Result.ItemNewQty  = ((WarehouseData)(WareHouseData)).ItemC0 + ItemAddItemData.Quantity;
                    Result.ItemUCCKey  = ((WarehouseData)(WareHouseData)).ItemUCCUnique;
                    Result.ItemFlag    = (byte)((WarehouseData)(WareHouseData)).ItemFlag;
                    Result.ItemEndDate = null;
                    //Add
                    ((WarehouseData)(WareHouseData)).AddQuantity(ItemAddItemData.Quantity);

                    if (ItemAddItemData.Transaction)
                    {
                        ItemTransaction.AddItem(0x02, (WarehouseData)WareHouseData, ItemAddItemData.Quantity);
                    }
                }

                else if (WareHouseData == null)
                {
                    return(AddItemToDB(ItemAddItemData));
                }
            }
            break;

            case IffGroupFlag.ITEM_TYPE_CADDIE:
            {
                return(AddItemToDB(ItemAddItemData));
            }

            case IffGroupFlag.ITEM_TYPE_CADDIE_ITEM:
            {
                WareHouseData = ItemCaddie.GetCaddieBySkinId(ItemAddItemData.ItemIffId);

                if (!(WareHouseData == null))
                {
                    ((CaddieData)(WareHouseData)).Update();
                    ((CaddieData)(WareHouseData)).UpdateCaddieSkin(ItemAddItemData.ItemIffId, ItemAddItemData.Day);
                    Result.Status      = true;
                    Result.ItemIndex   = ((CaddieData)(WareHouseData)).CaddieIdx;
                    Result.ItemTypeID  = ((CaddieData)(WareHouseData)).CaddieSkin;
                    Result.ItemOldQty  = 1;
                    Result.ItemNewQty  = 1;
                    Result.ItemUCCKey  = string.Empty;
                    Result.ItemFlag    = 0;
                    Result.ItemEndDate = DateTime.Now.AddDays(ItemAddItemData.Day);
                }
            }
            break;

            case IffGroupFlag.ITEM_TYPE_SKIN:
            {
                return(AddItemToDB(ItemAddItemData));
            }

            case IffGroupFlag.ITEM_TYPE_MASCOT:
            {
                WareHouseData = ItemMascot.GetMascotByTypeId(ItemAddItemData.ItemIffId);

                if (WareHouseData != null)
                {
                    ((MascotData)(WareHouseData)).AddDay(ItemAddItemData.Day);
                    Result.Status      = true;
                    Result.ItemIndex   = ((MascotData)(WareHouseData)).MascotIndex;
                    Result.ItemTypeID  = ((MascotData)(WareHouseData)).MascotTypeID;
                    Result.ItemOldQty  = 1;
                    Result.ItemNewQty  = 1;
                    Result.ItemUCCKey  = "";
                    Result.ItemFlag    = 0;
                    Result.ItemEndDate = ((MascotData)(WareHouseData)).MascotEndDate;
                }
                else if (WareHouseData == null)
                {
                    return(AddItemToDB(ItemAddItemData));
                }
            }
            break;

            case IffGroupFlag.ITEM_TYPE_CARD:
            {
                WareHouseData = ItemCard.GetCard(ItemAddItemData.ItemIffId, 1);

                if (WareHouseData == null)
                {
                    AddItemToDB(ItemAddItemData);
                }
                else if (WareHouseData != null)
                {
                    Result.Status      = true;
                    Result.ItemIndex   = ((CardData)(WareHouseData)).CardIndex;
                    Result.ItemTypeID  = ((CardData)(WareHouseData)).CardTypeID;
                    Result.ItemOldQty  = ((CardData)(WareHouseData)).CardQuantity;
                    Result.ItemNewQty  = ((CardData)(WareHouseData)).CardQuantity + ItemAddItemData.Quantity;
                    Result.ItemUCCKey  = string.Empty;
                    Result.ItemFlag    = 0;
                    Result.ItemEndDate = null;

                    ((CardData)(WareHouseData)).AddQuantity(ItemAddItemData.Quantity);

                    if (ItemAddItemData.Transaction)
                    {
                        ItemTransaction.AddCard(0x02, (CardData)WareHouseData, ItemAddItemData.Quantity);
                    }
                }
            }
            break;
            }
            return(Result);
        }
Exemplo n.º 18
0
        public AddItemData AddItemToDB(AddItem ItemAddItemData)
        {
            Object          PlayerObjectData;
            TransactionData Tran;
            AddItemData     Result;

            Result = new AddItemData()
            {
                Status = false
            };
            var _db     = new PangyaEntities();
            var additem = _db.ProcAddItem((int)UID, (int)ItemAddItemData.ItemIffId, (int)ItemAddItemData.Quantity, Compare.IfCompare <byte>(IFFEntry.GetIff.IsSelfDesign(ItemAddItemData.ItemIffId), 1, 0), IFFEntry.GetIff.GetItemTimeFlag(ItemAddItemData.ItemIffId, ItemAddItemData.Day), (int)ItemAddItemData.Day).ToList();

            if (additem.Count > 0)
            {
                var dbdata = additem.FirstOrDefault();

                Tran = new TransactionData()
                {
                    Types = 2, Index = (uint)dbdata.IDX, TypeID = (uint)dbdata.iffTypeId, PreviousQuan = 0, NewQuan = (uint)dbdata.Quantity, UCC = dbdata.UCC_KEY
                };

                ItemTransaction.Add(Tran);
                try
                {
                    switch (ItemAddItemData.ItemIffId.GetItemGroup())
                    {
                    case IffGroupFlag.ITEM_TYPE_CHARACTER:
                    {
                        PlayerObjectData = new CharacterData();

                        ((CharacterData)(PlayerObjectData)).Index      = (uint)dbdata.IDX;
                        ((CharacterData)(PlayerObjectData)).TypeID     = (uint)dbdata.iffTypeId;
                        ((CharacterData)(PlayerObjectData)).HairColour = 0;
                        ((CharacterData)(PlayerObjectData)).GiftFlag   = 0;
                        ItemCharacter.CharacterAdd((CharacterData)(PlayerObjectData));

                        CharacterIndex = (uint)dbdata.IDX;
                        Result         = new AddItemData()
                        {
                            Status      = true,
                            ItemIndex   = ((CharacterData)(PlayerObjectData)).Index,
                            ItemTypeID  = ((CharacterData)(PlayerObjectData)).TypeID,
                            ItemOldQty  = 1,
                            ItemNewQty  = 1,
                            ItemUCCKey  = string.Empty,
                            ItemFlag    = 0,
                            ItemEndDate = DateTime.MinValue,
                        };
                    }
                    break;

                    case IffGroupFlag.ITEM_TYPE_AUX:
                    case IffGroupFlag.ITEM_TYPE_PART:
                    case IffGroupFlag.ITEM_TYPE_CLUB:
                    case IffGroupFlag.ITEM_TYPE_BALL:
                    case IffGroupFlag.ITEM_TYPE_USE:
                    case IffGroupFlag.ITEM_TYPE_SKIN:
                    {
                        PlayerObjectData = new WarehouseData();
                        ((WarehouseData)(PlayerObjectData)).ItemIndex     = (uint)dbdata.IDX;
                        ((WarehouseData)(PlayerObjectData)).ItemTypeID    = (uint)dbdata.iffTypeId;
                        ((WarehouseData)(PlayerObjectData)).ItemC0        = (ushort)dbdata.Quantity;
                        ((WarehouseData)(PlayerObjectData)).ItemUCCUnique = dbdata.UCC_KEY;
                        ((WarehouseData)(PlayerObjectData)).CreateNewItem();
                        // Add to inventory list
                        ItemWarehouse.ItemAdd((WarehouseData)(PlayerObjectData));
                        // Set the result data
                        Result = new AddItemData()
                        {
                            Status      = true,
                            ItemIndex   = ((WarehouseData)(PlayerObjectData)).ItemIndex,
                            ItemTypeID  = ((WarehouseData)(PlayerObjectData)).ItemTypeID,
                            ItemOldQty  = 0,
                            ItemNewQty  = ItemAddItemData.Quantity,
                            ItemUCCKey  = ((WarehouseData)(PlayerObjectData)).ItemUCCUnique,
                            ItemFlag    = 0,
                            ItemEndDate = null,
                        };
                    }
                    break;

                    case IffGroupFlag.ITEM_TYPE_CADDIE:
                    {
                        PlayerObjectData = new CaddieData();
                        ((CaddieData)(PlayerObjectData)).CaddieIdx     = (uint)dbdata.IDX;
                        ((CaddieData)(PlayerObjectData)).CaddieTypeId  = (uint)dbdata.iffTypeId;
                        ((CaddieData)(PlayerObjectData)).CaddieDateEnd = (DateTime)dbdata.END_DATE;
                        ((CaddieData)(PlayerObjectData)).CaddieAutoPay = 0;
                        ((CaddieData)(PlayerObjectData)).CaddieType    = (byte)dbdata.Flag;
                        // Add caddie to inventory list
                        ItemCaddie.CadieAdd((CaddieData)(PlayerObjectData));
                        // set the result data
                        Result = new AddItemData()
                        {
                            Status      = true,
                            ItemIndex   = ((CaddieData)(PlayerObjectData)).CaddieIdx,
                            ItemTypeID  = ((CaddieData)(PlayerObjectData)).CaddieTypeId,
                            ItemOldQty  = 0,
                            ItemNewQty  = 1,
                            ItemUCCKey  = string.Empty,
                            ItemFlag    = ((CaddieData)(PlayerObjectData)).CaddieType,
                            ItemEndDate = null,
                        };
                    }
                    break;

                    case IffGroupFlag.ITEM_TYPE_CARD:
                    {
                        PlayerObjectData = new CardData();
                        ((CardData)(PlayerObjectData)).CardIndex      = (uint)dbdata.IDX;
                        ((CardData)(PlayerObjectData)).CardTypeID     = (uint)dbdata.iffTypeId;
                        ((CardData)(PlayerObjectData)).CardQuantity   = ItemAddItemData.Quantity;
                        ((CardData)(PlayerObjectData)).CardIsValid    = 1;
                        ((CardData)(PlayerObjectData)).CardNeedUpdate = false;
                        // ## add to card
                        ItemCard.CardAdd((CardData)(PlayerObjectData));
                        // set the result data
                        Result = new AddItemData()
                        {
                            Status      = true,
                            ItemIndex   = ((CardData)(PlayerObjectData)).CardIndex,
                            ItemTypeID  = ((CardData)(PlayerObjectData)).CardTypeID,
                            ItemOldQty  = 0,
                            ItemNewQty  = ((CardData)(PlayerObjectData)).CardQuantity,
                            ItemUCCKey  = string.Empty,
                            ItemFlag    = 0,
                            ItemEndDate = null,
                        };
                    }
                    break;

                    case IffGroupFlag.ITEM_TYPE_MASCOT:
                    {
                        PlayerObjectData = new MascotData();
                        ((MascotData)(PlayerObjectData)).MascotIndex      = (uint)dbdata.IDX;
                        ((MascotData)(PlayerObjectData)).MascotTypeID     = (uint)dbdata.iffTypeId;
                        ((MascotData)(PlayerObjectData)).MascotMessage    = "Pangya !";
                        ((MascotData)(PlayerObjectData)).MascotIsValid    = 1;
                        ((MascotData)(PlayerObjectData)).MascotNeedUpdate = false;
                        ((MascotData)(PlayerObjectData)).MascotEndDate    = (DateTime)dbdata.END_DATE;

                        ((MascotData)(PlayerObjectData)).MascotDayToEnd = (ushort)dbdata.END_DATE.DaysBetween(DateTime.Now);
                        // ## add to card
                        ItemMascot.MascotAdd((MascotData)(PlayerObjectData));
                        // set the result data
                        Result = new AddItemData()
                        {
                            Status      = true,
                            ItemIndex   = ((MascotData)(PlayerObjectData)).MascotIndex,
                            ItemTypeID  = ((MascotData)(PlayerObjectData)).MascotTypeID,
                            ItemOldQty  = 0,
                            ItemNewQty  = 1,
                            ItemUCCKey  = string.Empty,
                            ItemFlag    = 4,
                            ItemEndDate = DateTime.Now.AddDays(ItemAddItemData.Day + 1),
                        };
                    }
                    break;
                    }
                }
                catch
                {
                }
            }
            // ## resulted
            return(Result);
        }
Exemplo n.º 19
0
 public byte[] GetCharData(uint Index)
 {
     return(ItemCharacter.GetCharData(Index));
 }