示例#1
0
        private void chkNull(OldItem p)
        {
            long    chk  = 0;
            Decimal chk1 = 0;

            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;

            //p.item_type_id = p.item_type_id == null ? "" : p.item_type_id;
            p.item_type = p.item_type == null ? "" : p.item_type;
            //p.average_price = p.average_price == null ? "" : p.average_price;
            p.item_trade_name  = p.item_trade_name == null ? "" : p.item_trade_name;
            p.item_name        = p.item_name == null ? "" : p.item_name;
            p.item_common_name = p.item_common_name == null ? "" : p.item_common_name;
            p.item_code        = p.item_code == null ? "" : p.item_code;

            p.total_price   = Decimal.TryParse(p.total_price, out chk1) ? chk.ToString() : "0";
            p.unit_price    = Decimal.TryParse(p.unit_price, out chk1) ? chk.ToString() : "0";
            p.average_price = Decimal.TryParse(p.average_price, out chk1) ? chk.ToString() : "0";
            p.total_price   = Decimal.TryParse(p.total_price, out chk1) ? chk.ToString() : "0";


            p.DUID         = long.TryParse(p.DUID, out chk) ? chk.ToString() : "0";
            p.item_type_id = long.TryParse(p.item_type_id, out chk) ? chk.ToString() : "0";
            p.total_qty    = long.TryParse(p.total_qty, out chk) ? chk.ToString() : "0";
            p.DUID_QTY     = long.TryParse(p.DUID_QTY, out chk) ? chk.ToString() : "0";
        }
        public ListHitViewer()
        {
            InitializeComponent();
            db = new DBHelper();

            //load up the app bar
            ApplicationBar = new ApplicationBar();

            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            ApplicationBar.Opacity = 1.0;
            ApplicationBar.IsVisible = true;
            ApplicationBar.IsMenuEnabled = true;

            //get the item from the phone state!  woo!
            if (PhoneApplicationService.Current.State.ContainsKey("CurrentItem") && PhoneApplicationService.Current.State["CurrentItem"] != null)
            {
                _item = PhoneApplicationService.Current.State["CurrentItem"] as OldItem;

                //only show share if the _item is not null
                ApplicationBarIconButton btnShareAppBar = new ApplicationBarIconButton();
                btnShareAppBar.IconUri = new Uri("/Assets/AppBarIcons/share.png", UriKind.Relative);
                btnShareAppBar.Text = "Tap To Share";
                ApplicationBar.Buttons.Add(btnShareAppBar);
                btnShareAppBar.Click += new EventHandler(btnShareAppBar_Click);
            }

            //feedback button
            ApplicationBarIconButton btnFeedbackAppBar = new ApplicationBarIconButton();
            btnFeedbackAppBar.IconUri = new Uri("/Assets/AppBarIcons/questionmark.png", UriKind.Relative);
            btnFeedbackAppBar.Text = "Feedback";
            ApplicationBar.Buttons.Add(btnFeedbackAppBar);
            btnFeedbackAppBar.Click += new EventHandler(btnFeedbackAppBar_Click);
        }
示例#3
0
        private void initConfig()
        {
            oitm                  = new OldItem();
            loItm                 = new List <OldItem>();
            oitm.id               = "id";
            oitm.item_type_id     = "item_type_id";
            oitm.item_type        = "item_type";
            oitm.item_name        = "item_name";
            oitm.total_price      = "total_price";
            oitm.total_qty        = "total_qty";
            oitm.unit_price       = "unit_price";
            oitm.average_price    = "average_price";
            oitm.DUID             = "DUID";
            oitm.DUID_QTY         = "DUID_QTY";
            oitm.active           = "active";
            oitm.item_code        = "item_code";
            oitm.item_common_name = "item_common_name";
            oitm.item_trade_name  = "item_trade_name";

            oitm.date_create = "date_create";
            oitm.date_modi   = "date_modi";
            oitm.date_cancel = "date_cancel";
            oitm.user_create = "user_create";
            oitm.user_modi   = "user_modi";

            oitm.table   = "b_item";
            oitm.pkField = "id";
        }
示例#4
0
        public void getloItm()
        {
            //lDept = new List<Position>();

            loItm.Clear();
            DataTable dt = new DataTable();

            dt = selectAll();
            foreach (DataRow row in dt.Rows)
            {
                OldItem itm1 = new OldItem();
                itm1.id            = row[oitm.id].ToString();
                itm1.item_type_id  = row[oitm.item_type_id].ToString();
                itm1.item_type     = row[oitm.item_type].ToString();
                itm1.item_name     = row[oitm.item_name].ToString();
                itm1.total_price   = row[oitm.total_price].ToString();
                itm1.total_qty     = row[oitm.total_qty].ToString();
                itm1.unit_price    = row[oitm.unit_price].ToString();
                itm1.average_price = row[oitm.average_price].ToString();
                itm1.DUID          = row[oitm.DUID].ToString();
                itm1.DUID_QTY      = row[oitm.DUID_QTY].ToString();
                itm1.active        = row[oitm.active].ToString();
                itm1.item_code     = row[oitm.item_code].ToString();
                itm1.date_create   = row[oitm.date_create].ToString();
                itm1.date_modi     = row[oitm.date_modi].ToString();
                itm1.date_cancel   = row[oitm.date_cancel].ToString();
                itm1.user_create   = row[oitm.user_create].ToString();
                itm1.user_modi     = row[oitm.user_modi].ToString();
                //itm1.item_code = row[oitm.item_code].ToString();
                loItm.Add(itm1);
            }
        }
示例#5
0
        protected override void HandlePacket(Client client, PlayerShootPacket packet)
        {
            client.Manager.Logic.AddPendingAction(t =>
            {
                if (client.Player.Owner == null)
                {
                    return;
                }

                OldItem item = client.Player.Manager.GameData.Items[(ushort)packet.ContainerType];
                int stype    = 0;

                for (int i = 0; i < 4; i++)
                {
                    if (client.Player.Inventory[i]?.ObjectType == packet.ContainerType)
                    {
                        stype = i;
                        break;
                    }
                }

                if (item == Client.Player.SerialConvert(Client.Player.Inventory[1]))
                {
                    return; // ability shoot handled by useitem implement ability check
                }
                if (client.Player.SlotTypes[stype] != item.SlotType)
                {
                    Client.Player.kickforCheats(Player.possibleExploit.DIFF_WEAPON);
                    return;
                }
                if ((Client.Stage != ProtocalStage.Disconnected) && (!Client.Player.CheckShootSpeed(item)))
                {
                    return;
                }
                if (Client.Stage == ProtocalStage.Disconnected)
                {
                    return;
                }

                ProjectileDesc prjDesc = item.Projectiles[0]; //Assume only one

                Projectile prj = client.Player.PlayerShootProjectile(
                    packet.BulletId, prjDesc, item.ObjectType,
                    packet.Time, packet.Position, packet.Angle);
                client.Player.Owner.EnterWorld(prj);
                client.Player.BroadcastSync(new AllyShootPacket
                {
                    OwnerId       = client.Player.Id,
                    Angle         = packet.Angle,
                    ContainerType = packet.ContainerType,
                    BulletId      = packet.BulletId
                }, p => p != client.Player && client.Player.Dist(p) < 25);
                client.Player.FameCounter.Shoot(prj);
            }, PendingPriority.Networking);
        }
        public Item save(Item item)
        {
            OldItem oldItem = new OldItem();

            Utils.Util.propertyCopy(item, oldItem);
            this._dbManager.Add(oldItem);
            var entityItem = this._dbManager.Add(item);

            this._dbManager.SaveChanges();
            return(entityItem.Entity);
        }
示例#7
0
 public static bool checkItem(OldItem item)
 {
     for (var i = 0; i < NoShopContains.Length; i++)
     {
         if (item.ObjectId.Contains(NoShopContains[i]))
         {
             return(false);
         }
     }
     if ((item.Tier == -1 || item.Tier >= 4) && item.Treasure == false)
     {
         return(true);
     }
     return(false);
 }
        public bool CheckShootSpeed(OldItem item)
        {
            shootCounter++;
            if (lastShootTime == -1)
            {
                lastShootTime = Environment.TickCount;
            }

            int   tolerance = 240;
            float diff      = (Environment.TickCount - lastShootTime) + tolerance;
            var   dt        = (int)(1 / StatsManager.GetAttackFrequency() * 1 / item.RateOfFire);

            if (diff < dt)
            {
                if (shootCounter > item.NumProjectiles)
                {
                    dexShotViolation++;
                    dGoodCount = 0;
                    return(false);
                }
            }
            else
            {
                shootCounter  = 0;
                lastShootTime = Environment.TickCount;
                if (dexShotViolation > 0)
                {
                    dGoodCount++;
                    if (dGoodCount >= 2)
                    {
                        dexShotViolation = 0;
                        dGoodCount       = 0;
                    }
                }
                else
                {
                    dGoodCount = 0;
                }
            }
            return(true);
        }
示例#9
0
        private async void Modified(string Path)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, async() =>
            {
                try
                {
                    await Locker.WaitAsync();

                    try
                    {
                        if (CurrentLocation == System.IO.Path.GetDirectoryName(Path))
                        {
                            if (await FileSystemStorageItemBase.OpenAsync(Path) is FileSystemStorageItemBase ModifiedItem)
                            {
                                PathConfiguration Config = await SQLite.Current.GetPathConfigurationAsync(CurrentLocation);

                                if (CurrentCollection.FirstOrDefault((Item) => Item.Path.Equals(Path, StringComparison.OrdinalIgnoreCase)) is FileSystemStorageItemBase OldItem)
                                {
                                    if (ModifiedItem.GetType() == OldItem.GetType())
                                    {
                                        await OldItem.RefreshAsync();
                                    }
                                    else
                                    {
                                        CurrentCollection.Remove(OldItem);

                                        if (!SettingControl.IsDisplayProtectedSystemItems || !ModifiedItem.IsSystemItem)
                                        {
                                            if ((ModifiedItem is IHiddenStorageItem && SettingControl.IsDisplayHiddenItem) || ModifiedItem is not IHiddenStorageItem)
                                            {
                                                if (CurrentCollection.Any())
                                                {
                                                    int Index = SortCollectionGenerator.SearchInsertLocation(CurrentCollection, ModifiedItem, Config.SortTarget.GetValueOrDefault(), Config.SortDirection.GetValueOrDefault());

                                                    if (Index >= 0)
                                                    {
                                                        CurrentCollection.Insert(Index, ModifiedItem);
                                                    }
                                                    else
                                                    {
                                                        CurrentCollection.Add(ModifiedItem);
                                                    }
                                                }
                                                else
                                                {
                                                    CurrentCollection.Add(ModifiedItem);
                                                }
                                            }
                                        }
                                    }
                                }
                                else if (ModifiedItem is not IHiddenStorageItem)
                                {
                                    if (CurrentCollection.Any())
                                    {
                                        int Index = SortCollectionGenerator.SearchInsertLocation(CurrentCollection, ModifiedItem, Config.SortTarget.GetValueOrDefault(), Config.SortDirection.GetValueOrDefault());

                                        if (Index >= 0)
                                        {
                                            CurrentCollection.Insert(Index, ModifiedItem);
                                        }
                                        else
                                        {
                                            CurrentCollection.Add(ModifiedItem);
                                        }
                                    }
                                    else
                                    {
                                        CurrentCollection.Add(ModifiedItem);
                                    }
                                }
                            }
                        }
                    }
                    finally
                    {
                        Locker.Release();
                    }
                }
                catch (Exception ex)
                {
                    LogTracer.Log(ex, $"{ nameof(StorageAreaWatcher)}: Modify item in collection failed");
                }
            });
示例#10
0
        public void AddObjects(XElement root)
        {
            foreach (XElement elem in root.XPathSelectElements("//Object"))
            {
                if (elem.Element("Class") == null)
                {
                    continue;
                }
                string cls = elem.Element("Class").Value;
                string id  = elem.Attribute("id").Value;

                ushort     type;
                XAttribute typeAttr = elem.Attribute("type");
                if (typeAttr == null)
                {
                    type = (ushort)assign.Assign(id, elem);
                }
                else
                {
                    type = (ushort)Utils.FromString(typeAttr.Value);
                }

                if (cls == "PetBehavior" || cls == "PetAbility")
                {
                    continue;
                }

                if (type2id_obj.ContainsKey(type))
                {
                    Console.WriteLine("'{0}' and '{1}' has the same ID of 0x{2:x4}!", id, type2id_obj[type], type);
                }
                if (id2type_obj.ContainsKey(id))
                {
                    Console.WriteLine("0x{0:x4} and 0x{1:x4} has the same name of {2}!", type, id2type_obj[id], id);
                }

                type2id_obj[type]   = id;
                id2type_obj[id]     = type;
                type2elem_obj[type] = elem;

                switch (cls)
                {
                case "Equipment":
                case "Dye":
                    items[type] = new OldItem(type, elem);
                    break;

                case "Portal":
                case "GuildHallPortal":
                    try
                    {
                        portals[type] = new PortalDesc(type, elem);
                    }
                    catch
                    {
                        Console.WriteLine("Error for portal: " + type + " id: " + id);

                        /*3392,1792,1795,1796,1805,1806,1810,1825 -- no location, assume nexus?*
                         *  Tomb Portal of Cowardice,  Dungeon Portal,  Portal of Cowardice,  Realm Portal,  Glowing Portal of Cowardice,  Glowing Realm Portal,  Nexus Portal,  Locked Wine Cellar Portal*/
                    }
                    break;

                case "Pet":
                    type2pet[type] = new PetStruct(type, elem);
                    break;

                case "PetSkin":
                    id2pet_skin[id] = new PetSkin(type, elem);
                    break;

                case "PetBehavior":
                case "PetAbility":
                    break;

                default:
                    objDescs[type] = new ObjectDesc(type, elem);
                    break;
                }

                XAttribute extAttr = elem.Attribute("ext");
                bool       ext;
                if (extAttr != null && bool.TryParse(extAttr.Value, out ext) && ext)
                {
                    if (elem.Attribute("type") == null)
                    {
                        elem.Add(new XAttribute("type", type));
                    }
                    addition.Add(elem);
                    updateCount++;
                }
            }
        }
示例#11
0
        public Item CreateSerial(OldItem item, string DroppedIn, bool soulbound = false, bool insert = true, int _id = -1)
        {
            int id;

            if (insert && _id == -1)
            {
                using (var db = new Database())
                {
                    id = db.GetNextSerialId();
                }
            }
            else
            {
                id = _id;
            }
            Item ret = new Item
            {
                serialId           = id,
                ObjectType         = item.ObjectType,
                firstUser          = -1,
                currentUser        = -1,
                droppedIn          = DroppedIn,
                Soulbound          = soulbound,
                banned             = 0,
                ObjectId           = item.ObjectId,
                SlotType           = item.SlotType,
                Tier               = item.Tier,
                Description        = item.Description,
                RateOfFire         = item.RateOfFire,
                Usable             = item.Usable,
                BagType            = item.BagType,
                MpCost             = item.MpCost,
                FameBonus          = item.FameBonus,
                NumProjectiles     = item.NumProjectiles,
                ArcGap             = item.ArcGap,
                Consumable         = item.Consumable,
                Potion             = item.Potion,
                DisplayId          = item.DisplayId,
                SuccessorId        = item.SuccessorId,
                Cooldown           = item.Cooldown,
                Resurrects         = item.Resurrects,
                Texture1           = item.Texture1,
                Texture2           = item.Texture2,
                Secret             = item.Secret,
                IsBackpack         = item.IsBackpack,
                Rarity             = item.Rarity,
                Family             = item.Family,
                Class              = item.Class,
                Doses              = item.Doses,
                StatsBoost         = item.StatsBoost,
                ActivateEffects    = item.ActivateEffects,
                Projectiles        = item.Projectiles,
                MpEndCost          = item.MpEndCost,
                Timer              = item.Timer,
                XpBooster          = item.XpBooster,
                LootDropBooster    = item.LootDropBooster,
                LootTierBooster    = item.LootTierBooster,
                SetType            = item.SetType,
                BrokenResurrect    = item.BrokenResurrect,
                NotBrokenResurrect = item.NotBrokenResurrect,
                MantleResurrect    = item.MantleResurrect,
                MpGiveBack         = item.MpGiveBack,
                Treasure           = item.Treasure,
                Maxy               = item.Maxy,
                FeedPower          = item.FeedPower
            };

            if (insert)
            {
                using (var db = new Database())
                {
                    db.InsertSerial(ret);
                }
            }
            return(ret);
        }
 /// <summary>
 /// Called when users wants to share an Item with another user from a search term or browser window.
 /// </summary>
 private void initiateProximityOperation(OldItem _item)
 {
     if (NFCIsSupportedOnDevice())
     {
         string itemName = _item.name.Trim();
         itemName = Uri.EscapeDataString(itemName);
         MainPage.currentHTML = retrieveHistoryOrFavoriteResult(_item.ItemSQL);
         if (!itemName.Contains("<script>") && !itemName.Contains("http://") && !itemName.Contains("/"))
         {
             NavigationService.Navigate(new Uri("/ProximityInfo.xaml?Name=" + itemName + "&IsHost=true", UriKind.Relative));
         }
         else
         {
             MessageBox.Show("Invalid item detected.  Unable to initiate share operation.");
         }
     }
 }
示例#13
0
        private static List <AbilityItem> GetPetAbilites(OldItem egg, PetStruct petStruct)
        {
            List <Ability> abilities = new List <Ability>
            {
                Ability.AttackClose,
                Ability.AttackFar,
                Ability.AttackMid,
                Ability.Decoy,
                Ability.Electric,
                Ability.Heal,
                Ability.MagicHeal,
                Ability.RisingFury,
                Ability.Savage
            };

            Random             rand = new Random((int)DateTime.Now.Ticks);
            List <AbilityItem> ret  = new List <AbilityItem>(3);
            int power = 1;

            switch (egg.Rarity)
            {
            case Rarity.Uncommon:
                power = 30;
                break;

            case Rarity.Rare:
                power = 50;
                break;

            case Rarity.Legendary:
                power = 70;
                break;
            }

            for (int i = 0; i < 3; i++)
            {
                if (i == 0 && petStruct.FirstAbility != null)
                {
                    ret.Add(new AbilityItem
                    {
                        Power  = power,
                        Points = 0,
                        Type   = (int)petStruct.FirstAbility
                    });

                    abilities.Remove((Ability)petStruct.FirstAbility);
                }
                else
                {
                    Ability ability = abilities[rand.Next(abilities.Count)];
                    ret.Add(new AbilityItem
                    {
                        Power  = power,
                        Points = 0,
                        Type   = (int)ability
                    });

                    if (ability == Ability.AttackClose || ability == Ability.AttackFar || ability == Ability.AttackMid)
                    {
                        abilities.Remove(Ability.AttackClose);
                        abilities.Remove(Ability.AttackFar);
                        abilities.Remove(Ability.AttackMid);
                    }
                    else
                    {
                        abilities.Remove(ability);
                    }
                }
            }


            return(ret);
        }
示例#14
0
        public static async void Create(RealmManager manager, Player player, OldItem egg)
        {
            await manager.Database.DoActionAsync(db =>
            {
                PetStruct petStruct = GetPetStruct(manager, egg.Family, (Rarity)egg.Rarity);
                PetSkin skin        = manager.GameData.IdToPetSkin[petStruct.DefaultSkin];

                PetItem item = new PetItem
                {
                    InstanceId = db.GetNextPetId(player.AccountId),
                    Rarity     = (int)egg.Rarity,
                    SkinName   = skin.DisplayId,
                    Skin       = skin.ObjectType,
                    Type       = petStruct.ObjectType,
                    Abilities  = GetPetAbilites(egg, petStruct)
                };

                switch (item.Rarity)
                {
                case 1:
                    item.MaxAbilityPower     = 50;
                    item.Abilities[0].Power  = 30;
                    item.Abilities[0].Points = 2080;
                    item.Abilities[1].Power  = 11;
                    item.Abilities[1].Points = 290;
                    item.Abilities[2].Power  = 1;
                    item.Abilities[2].Points = 0;
                    break;

                case 2:
                    item.MaxAbilityPower     = 70;
                    item.Abilities[0].Power  = 50;
                    item.Abilities[0].Points = 10607;
                    item.Abilities[1].Power  = 30;
                    item.Abilities[1].Points = 2080;
                    item.Abilities[2].Power  = 1;
                    item.Abilities[2].Points = 0;
                    break;

                case 3:
                    item.MaxAbilityPower     = 90;
                    item.Abilities[0].Power  = 70;
                    item.Abilities[0].Points = 50355;
                    item.Abilities[1].Power  = 50;
                    item.Abilities[1].Points = 10607;
                    item.Abilities[2].Power  = 30;
                    item.Abilities[2].Points = 2080;
                    break;

                case 4:
                    item.MaxAbilityPower     = 100;
                    item.Abilities[0].Power  = 90;
                    item.Abilities[0].Points = 235610;
                    item.Abilities[1].Power  = 70;
                    item.Abilities[1].Points = 50354;
                    item.Abilities[2].Power  = 50;
                    item.Abilities[2].Points = 10607;
                    break;

                default:
                    item.MaxAbilityPower     = 30;
                    item.Abilities[0].Power  = 1;
                    item.Abilities[0].Points = 0;
                    item.Abilities[1].Power  = 1;
                    item.Abilities[1].Points = 0;
                    item.Abilities[2].Power  = 1;
                    item.Abilities[2].Points = 0;
                    break;
                }

                Pet pet = new Pet(manager, item, null);
                int x;
                int y;
                Random rand = new Random((int)DateTime.Now.Ticks);
                do
                {
                    x = rand.Next(0, player.Owner.Map.Width);
                    y = rand.Next(0, player.Owner.Map.Height);
                } while (player.Owner.Map[x, y].Region != TileRegion.Spawn);
                pet.Move(x + 0.5f, y + 0.5f);
                db.CreatePet(player.Client.Account, item);
                player.Owner.EnterWorld(pet);
                player.Client.SendPacket(new HatchEggPacket
                {
                    PetName   = skin.DisplayId,
                    PetSkinId = skin.ObjectType
                });
                player.Client.SendPacket(new UpdatePacket
                {
                    Tiles      = new UpdatePacket.TileData[0],
                    NewObjects = new ObjectDef[1] {
                        pet.ToDefinition()
                    },
                    RemovedObjectIds = new int[0]
                });
            });
        }