Inheritance: MonoBehaviour
 public void AddHat(string id)
 {
     Hat x = new Hat();
     x.ID = id;
     x.Description = "A HAT";
     Hats.Add(x);
 }
Exemple #2
0
    public virtual void ChangeHat(Hat newHat, float transmissionChance, PlayerClass initiator, PlayerClass self)
    {
        if (self != null && self.playerClass == Class.Detective)
        {
          return;
        }

        if (initiator != null && initiator.playerClass == Class.TrendSetter && initiator != self)
          initiator.score += 0.5f;

        // update the current hat
        SetCurrentHat(newHat);
        if(self != null && self.playerClass == Class.BaldMan)
        {
          self.BaldModeOff(); //self.baldMode = false;
        }
        // display swap animation (must be done in main thread)
        AnimTriggerString = "Hat";
        AnimTriggerWaiting = true;

        // trigger local trend
        if (transmissionChance > 0)
          InitiateTrend(newHat, transmissionChance, initiator);

        // initiate hat cooldown
        HatOnCooldown = true;
        HatCooldownTimer.Start();
    }
Exemple #3
0
 // For pickPocket!!!
 // called on a collision, passing in the colliding persons hat.
 public void HandleBump(GameObject gameObject, Hat bumpedHat)
 {
     if (playerClass == Class.PickPocket)
     {
       var thiefTrend = GetComponent<PlayerTrend>();
       var bumpedClass = gameObject.GetComponent<PlayerClass>();
       //Debug.Log("Is Pickpocket: " + theirHat.ToString() + " " + GetComponent<PlayerTrend>().CurrentHat.ToString());
       if (bumpedHat != thiefTrend.CurrentHat
       && rigidbody2D.velocity.magnitude > 0.05f
       && (bumpedClass == null || bumpedClass.score >= 8)
       && !gameObject.GetComponent<Trend>().StolenFromRecently)
       {
     Instantiate(testExplosion, transform.position, transform.rotation);
     score += 2;
     GetComponent<SFXPlayer>().PlaySFX("Crook");
     if (bumpedClass != null) // thief steals from other players
     {
       var bumpedTrend = gameObject.GetComponent<PlayerTrend>();
       bumpedTrend.StolenFromRecently = true;
       score += 6;
       gameObject.GetComponent<PlayerClass>().score -= 8;
     }
       }
     }
 }
Exemple #4
0
 public void AttachToPlayer()
 {
     Debug.Log("Pickup hat.");
     Hat.AttachToPlayer(gameObject.GetComponent<Player>(), closestHat);
     currentHat = closestHat;
     hatType = currentHat.hatType;
 }
Exemple #5
0
 public void DetachFromPlayer()
 {
     Debug.Log("Drop hat.");
     Hat.DetachFromPlayer(gameObject.GetComponent<Player>());
     currentHat = null;
     hatType = Hat.HatType.None;
 }
		static void Main(string[] args)
		{
			var shoeCloset = new List<IOnMyLegs>();
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Sneakers, Color = ShoeColor.Black });
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Clogs, Color = ShoeColor.Brown });
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Wingtips, Color = ShoeColor.Black });
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Loafers, Color = ShoeColor.White });
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Loafers, Color = ShoeColor.Red });
			shoeCloset.Add(new Shoe() { Style = ShoeStyle.Sneakers, Color = ShoeColor.Green });

			int numberOfShoes = shoeCloset.Count;
			foreach (Shoe shoe in shoeCloset)
			{
				shoe.Style = ShoeStyle.Flipflops;
				shoe.Color = ShoeColor.Orange;
			}

			shoeCloset.RemoveAt(4);

			Shoe thirdShoe = (Shoe)shoeCloset[2];
			Shoe secondShoe = (Shoe)shoeCloset[1];
			shoeCloset.Clear();

			shoeCloset.Add(thirdShoe);

			if (!shoeCloset.Contains(secondShoe))
			{
				Console.WriteLine("WTF?");
				
			}

			Console.ReadKey();

			IOonMyHead hat = new Hat();
		}
Exemple #7
0
    public override void ChangeHat(Hat newHat, float transmissionChance, PlayerClass initiator, PlayerClass self)
    {
        if (newHat != CurrentHat)
          StartSameTrendTimer = true;

        base.ChangeHat(newHat, transmissionChance, initiator, self);
        NoActionTimer.Stop();
    }
Exemple #8
0
 public void ChangeClass(Class c, Hat h)
 {
     playerClass = c;
     if (c == Class.BaldMan)
     {
       GetComponent<Trend>().SetCurrentHat(Hat.NoHat);
     }
     else
     {
       GetComponent<Trend>().SetCurrentHat(h);
     }
 }
Exemple #9
0
 public static void AttachToPlayer(Player player, Hat newHat)
 {
     newHat.wearer = player;
     newHat.transform.rotation = player.transform.rotation;
     //newHat.transform.rotation = new Quaternion(0, 0, 0, 1);
     newHat.rigidbody2D.isKinematic = true;
     Collider2D[] col = newHat.GetComponents<Collider2D>();
     foreach (Collider2D c in col )
     {
         c.enabled = false;
     }
     //newHat.collider2D.enabled = false;
     newHat.transform.position = player.hatHolder.position;
     newHat.transform.parent = player.hatHolder;
 }
        public override bool GrabItems()
        {
            if (Config.garbageCans && Location is Town town)
            {
                // impl @ StardewValley::Town::checkAction
                var garbageCheckedReflection = Mod.Helper.Reflection.GetField <NetArray <bool, NetBool> >(town, "garbageChecked", true);
                var garbageChecked           = garbageCheckedReflection.GetValue();
                var grabbed = false;
                for (int whichCan = 0; whichCan < garbageChecked.Length; whichCan++)
                {
                    Item obj = null;
                    if (garbageChecked[whichCan])
                    {
                        continue;
                    }
                    garbageChecked[whichCan] = true;
                    Random garbageRandom = new Random((int)Game1.uniqueIDForThisGame / 2 + (int)Game1.stats.DaysPlayed + 777 + whichCan * 77);
                    int    prewarm       = garbageRandom.Next(0, 100);
                    for (int k = 0; k < prewarm; k++)
                    {
                        garbageRandom.NextDouble();
                    }
                    prewarm = garbageRandom.Next(0, 100);
                    for (int j = 0; j < prewarm; j++)
                    {
                        garbageRandom.NextDouble();
                    }
                    //Game1.stats.incrementStat("trashCansChecked", 1);
                    var mega       = Game1.stats.getStat("trashCansChecked") > 20 && garbageRandom.NextDouble() < 0.01;
                    var doubleMega = Game1.stats.getStat("trashCansChecked") > 20 && garbageRandom.NextDouble() < 0.002;

                    if (doubleMega)
                    {
                        obj = new Hat(66);
                    }
                    else if (mega || garbageRandom.NextDouble() < 0.2 + Player.team.AverageDailyLuck())
                    {
                        int item = 168;
                        switch (garbageRandom.Next(10))
                        {
                        case 0:
                            item = 168;
                            break;

                        case 1:
                            item = 167;
                            break;

                        case 2:
                            item = 170;
                            break;

                        case 3:
                            item = 171;
                            break;

                        case 4:
                            item = 172;
                            break;

                        case 5:
                            item = 216;
                            break;

                        case 6:
                            item = Utility.getRandomItemFromSeason(Game1.currentSeason, whichCan, forQuest: false);
                            break;

                        case 7:
                            item = 403;
                            break;

                        case 8:
                            item = 309 + garbageRandom.Next(3);
                            break;

                        case 9:
                            item = 153;
                            break;
                        }
                        if (whichCan == 3 && garbageRandom.NextDouble() < 0.2 + Player.team.AverageDailyLuck())
                        {
                            item = 535;
                            if (garbageRandom.NextDouble() < 0.05)
                            {
                                item = 749;
                            }
                        }
                        if (whichCan == 4 && garbageRandom.NextDouble() < 0.2 + Player.team.AverageDailyLuck())
                        {
                            item = 378 + garbageRandom.Next(3) * 2;
                            garbageRandom.Next(1, 5);
                        }
                        if (whichCan == 5 && garbageRandom.NextDouble() < 0.2 + Player.team.AverageDailyLuck() && Game1.dishOfTheDay != null)
                        {
                            item = (((int)Game1.dishOfTheDay.parentSheetIndex != 217) ? ((int)Game1.dishOfTheDay.parentSheetIndex) : 216);
                        }
                        if (whichCan == 6 && garbageRandom.NextDouble() < 0.2 + Player.team.AverageDailyLuck())
                        {
                            item = 223;
                        }
                        if (whichCan == 7 && garbageRandom.NextDouble() < 0.2)
                        {
                            if (!Utility.HasAnyPlayerSeenEvent(191393))
                            {
                                item = 167;
                            }
                            if (Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheater") && !Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccMovieTheaterJoja"))
                            {
                                item = ((!(garbageRandom.NextDouble() < 0.25)) ? 270 : 809);
                            }
                        }
                        if (Game1.random.NextDouble() <= 0.25 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS"))
                        {
                            item = ItemIds.QiBeans;
                        }
                        obj = new SObject(item, 1);
                    }

                    grabbed = TryAddItem(obj) || grabbed;
                }
                return(grabbed);
            }
            else
            {
                return(false);
            }
        }
Exemple #11
0
    void VerticalCollisions(ref Vector2 moveAmount, bool isDead)
    {
        float directionY = Mathf.Sign(moveAmount.y);
        float rayLength  = Mathf.Abs(moveAmount.y) + skinWidth;

        for (int i = 0; i < verticalRayCount; i++)
        {
            Vector2 rayOrigin = (directionY == -1)?raycastOrigins.bottomLeft:raycastOrigins.topLeft;
            rayOrigin += Vector2.right * (verticalRaySpacing * i + moveAmount.x);
            RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.up * directionY, rayLength, collisionMask);

            Debug.DrawRay(rayOrigin, Vector2.up * directionY, Color.red);

            if (hit)
            {
                if (hit.transform.CompareTag("Ice") && moveAmount.y <= 0)
                {
                    Player player = GetComponent <Player>();

                    player.isSlidingOnIce = true;
                }
                else
                {
                    Player player = GetComponent <Player>();

                    player.isSlidingOnIce = false;
                }

                if (hit.transform.CompareTag("Balloon") && moveAmount.y > 0)
                {
                    continue;
                }

                if (hit.transform.CompareTag("Smash Ball"))
                {
                    continue;
                }

                if (hit.transform.CompareTag("Target"))
                {
                    continue;
                }

                if (hit.collider.CompareTag("Lava"))
                {
                    Player player = GetComponent <Player>();

                    player.BurnAss();

                    collisions.shouldBounceOnLava = true;
                }

                if (hit.collider.tag == "Through")
                {
//					if (directionY == 1 || hit.distance == 0) {
//						continue;
//					}

                    if (directionY == 1)
                    {
                        continue;
                    }
                    if (collisions.fallingThroughPlatform)
                    {
                        continue;
                    }
                    if (playerInput.y == -1)
                    {
                        collisions.fallingThroughPlatform = true;
                        Invoke("ResetFallingThroughPlatform", .01f);
                        continue;
                    }
                }

                if (collisions.below && hit.collider.tag == "Bounce")
                {
                    collisions.shouldBounceOnBouncyPlatform = true;


                    DieOnBounce d = hit.transform.GetComponent <DieOnBounce>();
                    if (d != null)
                    {
                        hit.transform.gameObject.SetActive(false);
                    }
                }

                if (hit.collider.CompareTag("Hat"))
                {
                    if (moveAmount.y > 0)
                    {
                        continue;
                    }

                    if (hit.collider.GetComponent <Hat>().isBeingAttached)
                    {
                        continue;
                    }

                    if (!hit.collider.GetComponent <Hat> ().isCurrentlyAttached)
                    {
                        if (!hit.collider.GetComponent <Hat>().isBeingThrown&& GetComponent <Player>().isStunned)
                        {
                            continue;
                        }

                        RaycastHit2D groundCheckBottomLeft  = Physics2D.Raycast(raycastOrigins.bottomLeft, Vector2.down, hit.distance + skinWidth * 2, deadMask);
                        RaycastHit2D groundCheckBottomRight = Physics2D.Raycast(raycastOrigins.bottomRight, Vector2.down, hit.distance + skinWidth * 2, deadMask);

                        if ((groundCheckBottomLeft || groundCheckBottomRight))
                        {
                            moveAmount.y     = (hit.distance) * directionY;
                            collisions.below = true;
                            continue;
                        }
                    }
                    else
                    {
                        hit.collider.GetComponent <Hat>().owner.BlowBack(new Vector3(collisions.faceDir * 10, 30f, 0), 10, 0.025f);
                        hit.collider.GetComponent <Hat>().KnockBack(new Vector3(-collisions.faceDir * 2, 2f, 0), 0.1f);
                    }
                }

                moveAmount.y = (hit.distance - skinWidth) * directionY;
                rayLength    = hit.distance;

                if (collisions.climbingSlope)
                {
                    moveAmount.x = moveAmount.y / Mathf.Tan(collisions.slopeAngle * Mathf.Deg2Rad) * Mathf.Sign(moveAmount.x);
                }

                collisions.below = directionY == -1;
                collisions.above = directionY == 1;

                if (collisions.below && hit.collider.tag == "Player")
                {
                    Player other = hit.collider.GetComponent <Player>();

                    if (other.isInvulnerable)
                    {
                        return;
                    }
                    if (other.hat.isBeingAttached)
                    {
                        return;
                    }
                    if (GetComponent <Player>().isStunned)
                    {
                        return;
                    }

                    if ((other.hat.isCurrentlyAttached && !other.hat.isBeingAttached) && GetComponent <Player>().GetVelocity().y < -1f && !other.isInvulnerable && GetComponent <Player>().canHurtHat)
                    {
                        //other.hat.LoseHatLife();
                        //GetComponent<Player>().canHurtHat = false;
                        //collisions.shouldBounce = true;
                        //GameController.instance.game.currentPlayers[other.GetComponent<Player>().playerIndex].UpdateStockUI();

                        //if (other.hat.currentHp <= 0) {
                        other.hat.KillOwner(GetComponent <Player>());
                        //} else {
                        //    other.hat.StartHitFlash();
                        //}
                    }
                    else
                    {
                        other.GetFootStooled(0.05f, GetComponent <Player>().isFastFalling);
                    }

                    collisions.shouldBounce = true;
                    collisions.below        = false;
                }
                else if (collisions.above && hit.collider.tag == "Player" && !hit.collider.GetComponent <Player>().isStunned&& hit.collider.GetComponent <Player>().GetVelocity().y < -1f)
                {
                    hit.collider.GetComponent <Controller2D> ().collisions.shouldBounce = true;
                    GetComponent <Player>().GetFootStooled(0.05f, GetComponent <Player>().isFastFalling);
                }

                if (collisions.below && hit.collider.tag == "Hat")
                {
                    if (GetComponent <Player>().isStunned)
                    {
                        continue;
                    }

                    Hat other = hit.collider.GetComponent <Hat> ();

                    if (other.isDying || other.isBeingAttached)
                    {
                        return;
                    }

                    if (hit.collider.GetComponent <Hat>().owner.isInvulnerable)
                    {
                        collisions.shouldBounce = true;
                        continue;
                    }

                    if (!other.isBeingThrown && !other.isBeingAttached && GetComponent <Player>().GetVelocity().y < -1f)
                    {
                        //collisions.shouldBounce = true;
                        collisions.below = false;

                        if (!other.owner.isInvulnerable && GetComponent <Player>().GetVelocity().y < -1 && GetComponent <Player>().canHurtHat)
                        {
                            //hit.collider.GetComponent<Hat>().LoseHatLife();
                            //GetComponent<Player>().canHurtHat = false;
                            //collisions.shouldBounce = true;
                            //GameController.instance.game.currentPlayers[hit.collider.GetComponent<Hat>().owner.playerIndex].UpdateStockUI();

                            //if (hit.collider.GetComponent<Hat>().currentHp <= 0)
                            hit.collider.GetComponent <Hat>().KillOwner(GetComponent <Player>());
                            //else {
                            //    hit.collider.GetComponent<Hat>().StartHitFlash();
                            //}
                        }
                    }
                }

                if (hit.transform.gameObject.name == "Balloon")
                {
                    collisions.shouldBounce = true;
                    Destroy(hit.transform.gameObject);
                    VFXManager.instance.EmitAtPosition("Balloon_Explosion", 30, hit.transform.position, true);
                    VFXManager.instance.EmitAtPosition("Balloon_Lines", 1, hit.transform.position, true);
                }
            }
        }

        if (collisions.climbingSlope)
        {
            float directionX = Mathf.Sign(moveAmount.x);
            rayLength = Mathf.Abs(moveAmount.x) + skinWidth;
            Vector2      rayOrigin = ((directionX == -1)?raycastOrigins.bottomLeft:raycastOrigins.bottomRight) + Vector2.up * moveAmount.y;
            RaycastHit2D hit       = Physics2D.Raycast(rayOrigin, Vector2.right * directionX, rayLength, collisionMask);

            if (hit)
            {
                float slopeAngle = Vector2.Angle(hit.normal, Vector2.up);
                if (slopeAngle != collisions.slopeAngle)
                {
                    moveAmount.x           = (hit.distance - skinWidth) * directionX;
                    collisions.slopeAngle  = slopeAngle;
                    collisions.slopeNormal = hit.normal;
                }
            }
        }
    }
Exemple #12
0
            public static void Postfix(FarmerRenderer __instance, Vector2 ___positionOffset, Hat __state, SpriteBatch b, int facingDirection, Farmer who, Vector2 position, Vector2 origin, float scale, int currentFrame, float rotation, Color overrideColor, float layerDepth)
            {
                if (!Config.EnableMod || __state is null)
                {
                    return;
                }
                who.hat.Value = __state;
                //string phase = who.hat.Value.modData[phaseKey];
                //string days = who.hat.Value.modData[daysKey];
                bool  flip         = who.FarmerSprite.CurrentAnimationFrame.flip;
                float layer_offset = 3.9E-05f;
                var   sourceRect   = new Rectangle(Convert.ToInt32(who.hat.Value.modData[xKey]), Convert.ToInt32(who.hat.Value.modData[yKey]), 16, 32);

                b.Draw(Game1.cropSpriteSheet, position + origin + ___positionOffset + new Vector2((float)(-8 + (flip ? -1 : 1) * FarmerRenderer.featureXOffsetPerFrame[currentFrame] * 4), (float)(-16 + FarmerRenderer.featureYOffsetPerFrame[currentFrame] * 4 + (who.hat.Value.ignoreHairstyleOffset.Value ? 0 : FarmerRenderer.hairstyleHatOffset[who.hair.Value % 16]) + 4 + __instance.heightOffset.Value)) + new Vector2(8, -80), sourceRect, Color.White, rotation, origin, 4f * scale, who.FacingDirection < 2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth + layer_offset);
            }
Exemple #13
0
 public HabboFigure SetHat(Hat value)
 {
     _hat = value;
     return this;
 }
Exemple #14
0
        public static Item getItem(string type, int index = -1, string name = "none")
        {
            Item item = null;

            if (type == "Object")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(index, 1);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(Game1.objectInformation.getIndexByName(name), 1);
                }
            }
            else if (type == "BigObject")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(Vector2.Zero, index);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(Vector2.Zero, Game1.bigCraftablesInformation.getIndexByName(name));
                }
            }
            else if (type == "Ring")
            {
                if (index != -1)
                {
                    item = new Ring(index);
                }
                else if (name != "none")
                {
                    item = new Ring(Game1.objectInformation.getIndexByName(name));
                }
            }
            else if (type == "Hat")
            {
                if (index != -1)
                {
                    item = new Hat(index);
                }
                else if (name != "none")
                {
                    item = new Hat(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/hats", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "Boots")
            {
                if (index != -1)
                {
                    item = new Boots(index);
                }
                else if (name != "none")
                {
                    item = new Boots(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Boots", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "Clothing")
            {
                if (index != -1)
                {
                    item = new Clothing(index);
                }
                else if (name != "none")
                {
                    item = new Clothing(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/ClothingInformation", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "TV")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.TV(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new TV(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent).getIndexByName(name), Vector2.Zero);
                }
            }
            else if (type == "IndoorPot")
            {
                item = new StardewValley.Objects.IndoorPot(Vector2.Zero);
            }
            else if (type == "CrabPot")
            {
                item = new StardewValley.Objects.CrabPot(Vector2.Zero);
            }
            else if (type == "Chest")
            {
                item = new StardewValley.Objects.Chest(true);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Furniture")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.Furniture(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new Furniture(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent).getIndexByName(name), Vector2.Zero);
                }
            }
            else if (type == "Sign")
            {
                item = new StardewValley.Objects.Sign(Vector2.Zero, index);
            }
            else if (type == "Wallpaper")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), false);
            }
            else if (type == "Floors")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), true);
            }
            else if (type == "MeleeWeapon")
            {
                if (index != -1)
                {
                    item = new MeleeWeapon(index);
                }
                else if (name != "none")
                {
                    item = new MeleeWeapon(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/weapons", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "CustomObject" && PyTK.CustomElementHandler.CustomObjectData.collection.ContainsKey(name))
            {
                item = PyTK.CustomElementHandler.CustomObjectData.collection[name].getObject();
            }
            else if (type == "SDVType")
            {
                try
                {
                    if (index == -1)
                    {
                        item = Activator.CreateInstance(PyUtils.getTypeSDV(name)) is Item i ? i : null;
                    }
                    else
                    {
                        item = Activator.CreateInstance(PyUtils.getTypeSDV(name), index) is Item i ? i : null;
                    }
                }
                catch (Exception ex)
                {
                    TMXLoaderMod.monitor?.Log(ex.Message + ":" + ex.StackTrace, LogLevel.Error);
                    TMXLoaderMod.monitor?.Log("Couldn't load item SDVType: " + name);
                }
            }
            else if (type == "ByType")
            {
                try
                {
                    if (index == -1)
                    {
                        item = Activator.CreateInstance(Type.GetType(name)) is Item i ? i : null;
                    }
                    else
                    {
                        item = Activator.CreateInstance(Type.GetType(name), index) is Item i ? i : null;
                    }
                }
                catch (Exception ex)
                {
                    TMXLoaderMod.monitor?.Log(ex.Message + ":" + ex.StackTrace, LogLevel.Error);
                    TMXLoaderMod.monitor?.Log("Couldn't load item ByType: " + name);
                }
            }

            return(item);
        }
Exemple #15
0
 public Skin(Beard beard, Hair hair, Hat hat, Body body, Tshirt tshirt, Pant pant, Gloves gloves, Eyes eyes)
 {
     this.beard = beard;
     this.hair = hair;
     this.hat = hat;
     this.body = body;
     this.tshirt = tshirt;
     this.pant = pant;
     this.gloves = gloves;
     this.eyes = eyes;
 }
Exemple #16
0
    // Use this for initialization
    void Start()
    {
        /* ---- SPELLS ----- */
        PlayerController playerscript = GetComponent(typeof(PlayerController)) as PlayerController;
        // ORGANIC
        // Methyl Blast
        Spell Methane1 = new Spell();
        SpellSet(Methane1, 0, "Methyl Blast", true, methane1icon, "Simple Methane explosion with 25 base power with a 1 second cast time.", 13,10,0,0,0,0,0,0,0,0,0,methane1iconUI,.8f, 1f);
        AllSpells[0] = Methane1;
        // Methanol Burst
        Spell Methanol1 = new Spell();
        SpellSet(Methanol1, 1, "Methanol Blast", true, methanol1icon, "Simple Methanol explosion with 25 base power.", 13,15,0,0,0,0,0,0,0,0,0,methanol1iconUI,2f, 1f);
        AllSpells[1] = Methanol1;
        // Ethane Burst
        Spell Ethane1 = new Spell();
        SpellSet(Ethane1, 2, "Ethyl Burst", true, ethane1icon, "Counterattack spell.\n\nConcentrated ethane explosion. Has a quarter second cast time with 25 base power.", 5, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, ethane1iconUI, 5f, .25f);
        AllSpells[2] = Ethane1;

        Spell CCl4 = new Spell();
        SpellSet(CCl4, 3, "Carbon Tetrachloride", true, ccl4icon, "Chills and deals 10 base damage to enemies within a wide radius. Carbon Tetrachloride is known for its refirdgerant properties.", 0, 5, 0.5f, 2f, 0, 0, 0, 0, 0, 0, 0, ccl4ui, 10, 0.3f);
        AllSpells[3] = CCl4;

        Spell CF4 = new Spell();
        SpellSet(CF4, 4, "Carbon Tetraflouride", true, cf4icon, "Throws an icicle spear that deals 10 base damage and snares the enemy it hits.", 10, 10, 0.2f, 2f, 0, 0, 0, 0, 0, 0, 5f, cf4ui, 5, 0f);
        AllSpells[4] = CF4;

        Spell Ethol = new Spell();
        SpellSet(Ethol, 5, "Ethanol Burst", true, etholicon, "More concentrated explosion that deals 35 base damage.", 20, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, etholui, 10, 1f);
        AllSpells[5] = Ethol;

        Spell Propane = new Spell();
        SpellSet(Propane, 6, "Propane Torch", true, propaneicon, "Extremely concentrated explosion that deals 50 base damage.", 25, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, propaneui, 10, 1f);
        AllSpells[6] = Propane;

        Spell Isopropanol = new Spell();
        SpellSet(Isopropanol, 7, "Isopropanol Wall", true, isopropanolicon, "Wall of Fire", 50, 0, 0, 0, 0, 40, 5, 0, 0, 0, 0, isopropanolui, 20, 1.5f);
        AllSpells[7] = Isopropanol;

        Spell propanol = new Spell();
        SpellSet(propanol, 8, "1-Propanol Circle", true, propanolicon, "circle of flame", 50, 0, 0, 0, 0, 40, 5, 0, 0, 0, 0, propanolui, 15, 1.5f);
        AllSpells[8] = propanol;

        Spell cfmethane = new Spell();
        SpellSet(cfmethane, 9, "Chlorofluoromethane Nova", true, cfmethaneicon, "frost nova", 40, 30, 0, 2, 0, 0, 0, 0, 0, 0, 0, cfmethaneui, 10, 0f);
        AllSpells[9] = cfmethane;

        Spell dcm = new Spell();
        SpellSet(dcm, 10, "Dichloromethane Wall", true, dcmicon, "anivia wall", 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, dcmui, 10, 1f);
        AllSpells[10] = dcm;

        Spell octof = new Spell();
        SpellSet(octof, 11, "Octofluoromethane Lance", true, octoficon, "ice lance", 60, 20, 0.4f, 2f, 0, 0, 0, 0, 0, 0, 0, octofui, 1f, 0f);
        AllSpells[11] = octof;

        Spell pentane = new Spell();
        SpellSet(pentane, 12, "Pentane Explosion", true, pentaneicon, "boom", 120, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, pentaneui, 30, 1.5f);
        AllSpells[12] = pentane;

        Spell hexane = new Spell();
        SpellSet(hexane, 13, "Hexane Boom", true, hexaneicon, "smaller boom", 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, hexaneui, 5f, 1f);
        AllSpells[13] = hexane;

        Spell acetylene = new Spell();
        SpellSet(acetylene, 14, "Acetylene Laser", true, acetyleneicon, "laser", 40, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, acetyleneui, 10f, 3f);
        AllSpells[14] = acetylene;

        Spell benzene = new Spell();
        SpellSet(benzene, 15, "Benzene Blast", true, benzeneicon, "boomer", 25, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, benzeneui, 2f, 1f);
        AllSpells[15] = benzene;

        Spell Otoluene = new Spell();
        SpellSet(Otoluene, 16, "Orthotoluidine Sear", true, orthotolueneicon, "small boomer", 40, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, orthotolueneui, 20f, 1f);
        AllSpells[16] = Otoluene;

        Spell Phenol = new Spell();
        SpellSet(Phenol, 17, "Phenol Ball", true, phenolicon, "fireball pun", 30, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, phenolui, 5, 1f);
        AllSpells[17] = Phenol;

        Spell ethglyc = new Spell();
        SpellSet(ethglyc, 19, "Ethylene Glycerol Wave", true, ethyleneglycerolicon, "ice wave", 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ethyleneglycerolui, 10, 0f);
        AllSpells[19] = ethglyc;

        Spell tetraf = new Spell();
        SpellSet(tetraf, 20, "1,1,1,2-Tetrafluoroethane Spear", true, tetraficon, "spear", 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, tetrafui, 1, 0f);
        AllSpells[20] = tetraf;

        Spell propylglyc = new Spell();
        SpellSet(propylglyc, 21, "Propyl Glycerol Laser", true, propylglycolicon, "ice aser", 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, propylglycolui, 0.6f, 1.5f);
        AllSpells[21] = propylglyc;

        Spell diethglyc = new Spell();
        SpellSet(diethglyc, 22, "Diethylene Glycerol Spikes", true, diethglycolicon, "ice spikes", 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diethglycolui, 60, 3f);
        AllSpells[22] = diethglyc;

        Spell phenylac = new Spell();
        SpellSet(phenylac, 23, "Phenyl Acetylene Plumes", true, phenylacetyleneicon, "lava plumes", 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, phenylacetyleneui, 60, 3f);
        AllSpells[23] = phenylac;

        Spell toluene = new Spell();
        SpellSet(toluene, 24, "Toluene Radiate", true, tolueneicon, "aoe all directions", 40, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, tolueneui, 15, 1.5f);
        AllSpells[24] = toluene;

        Spell nitrotoluene = new Spell();
        SpellSet(nitrotoluene, 25, "p-nitrotoluene flamethrower", true, nitrotolueneicon, "flamethrower", 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nitrotolueneui, 30, 1.5f);
        AllSpells[25] = nitrotoluene;

        Spell trinitrotoluene = new Spell();
        SpellSet(trinitrotoluene, 26, "Trinitrotoluene Speed Boost", true, trinitrotolueneicon, "speed", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, trinitrotolueneui, 30, 0f);
        AllSpells[26] = trinitrotoluene;

        Spell nitrobenzoicacid = new Spell();
        SpellSet(nitrobenzoicacid, 27, "4-Nitrobenzoic Acid Smash", true, nitrobenzoicacidicon, "smash symbol", 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nitrobenzoicacidui, 30, 2f);
        AllSpells[27] = nitrobenzoicacid;

        Spell benzoicacid = new Spell();
        SpellSet(benzoicacid, 28, "Benzoic Acid Concentrate", true, benzoicacidicon, "concentrate", 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, benzoicacidui, 15, 5f);
        AllSpells[28] = benzoicacid;

        Spell benzotrichloride = new Spell();
        SpellSet(benzotrichloride, 29, "Benzotrichloride Spears", true, benzotrichlorideicon, "spears all directions", 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, benzotrichlorideui, 10, 2f);
        AllSpells[29] = benzotrichloride;

        Spell benzoylchloride = new Spell();
        SpellSet(benzoylchloride, 30, "Benzoylchloride Blasts", true, benzoylchlorideicon, "ice mist 3 directions", 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, benzoylchlorideui, 10, 1f);
        AllSpells[30] = benzoylchloride;

        Spell rdx = new Spell();
        SpellSet(rdx, 31, "RDX Detonation", true, rdxicon, "huge boom", 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, rdxui, 2, 1.5f);
        AllSpells[31] = rdx;

        Spell co2 = new Spell();
        SpellSet(co2, 32, "CO2 Armor", true, co2icon, "Frost armor", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, co2ui, 45, 0f);
        AllSpells[32] = co2;

        Spell octanitrocubane = new Spell();
        SpellSet(octanitrocubane, 33, "Octanitrocubane Comets", true, octanitrocubaneicon, "firestorm", 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, octanitrocubaneui, 60, 2f);
        AllSpells[33] = octanitrocubane;

        Spell so2 = new Spell();
        SpellSet(so2, 34, "SO2 Icestorm", true, so2icon, "aoeice slow", 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, so2ui, 30, 2f);
        AllSpells[34] = so2;

        Spell detn = new Spell();
        SpellSet(detn, 35, "DETN Bomb", true, petnicon, "living bomb", 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, petnui, 5, 0.5f);
        AllSpells[35] = detn;

        Spell chloroform = new Spell();
        SpellSet(chloroform, 36, "Chloroform Hail", true, chloroformicon, "hail storm", 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chloroformui, 60, 2f);
        AllSpells[36] = chloroform;

        Spell odf = new Spell();
        SpellSet(odf, 37, "ODF Concentrate", true, odficon, "most concentrated ever", 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, odfui, 120, 5f);
        AllSpells[37] = odf;

        Spell fluoroform = new Spell();
        SpellSet(fluoroform, 38, "Fluoroform Lance", true, fluoroformicon, "ice lance better", 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fluoroformui, 2, 0f);
        AllSpells[38] = fluoroform;

        Spell octogen = new Spell();
        SpellSet(octogen, 39, "Octogen Swathe", true, octogenicon, "flame swathe", 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, octogenui, 10, 0f);
        AllSpells[39] = octogen;

        // INORGANIC

        Spell Bronze_Sw = new Spell();
        SpellSet(Bronze_Sw, 40, "Bronze Swings", false, bronzeswordicon, "Two Sword Swings that stun for half a second.", 15, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, bronzeswordUI, 1f, 0f);
        AllSpells[40] = Bronze_Sw;

        Spell Bronze_Sweep = new Spell();
        SpellSet(Bronze_Sweep, 41, "Bronze Sweep", false, bronzesword2icon, "One sword swing that stuns for 1 second.", 20, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, bronzesword2UI, 2f, 0f);
        AllSpells[41] = Bronze_Sweep;

        Spell Bronze_GS = new Spell();
        SpellSet(Bronze_GS, 42, "Bronze Greatsword", false, bronzegsicon, "Summon a greatsword that performs a large sweep and stuns for 2 seconds.", 30, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, bronzegsUI, 6f, 0f);
        AllSpells[42] = Bronze_GS;

        Spell Bronze_dagd = new Spell();
        SpellSet(Bronze_dagd, 43, "Bronze Dagger Throw", false, bronzedagicon, "Counterattack spell.\n\nDagger throw that deals 5 damage. If timed correctly right before some enemies attack, they can stagger and can then be counterattacked", 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, bronzedagUI, 2f, 0f);
        AllSpells[43] = Bronze_dagd;

        Spell Lithium = new Spell();
        SpellSet(Lithium, 44, "Lithium Spark", false, lithiumicon, "Lithium Spark that stuns for 5 seconds and deals 5 damage. Has 1 second cast time.", 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, lithiumUI, 30f, 1f);
        AllSpells[44] = Lithium;

        // BIOCHEM

        Spell Heme1 = new Spell();
        SpellSet(Heme1, 45, "Hemoglobin Drain", true, hemeicon, "Counterattack spell.\n\nThrow a bolt of blood and if it hits recover 5% of your health and deal twice that amount. If timed correctly right before some enemies attack, they can stagger and can then be counterattacked\nHemoglobin is the main oxygen carrier in the blood, and when disrupted can cause major damage.", 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, hemeui, 0.5f, 0.5f);
        AllSpells[45] = Heme1;

        Spell Aspirin = new Spell();
        SpellSet(Aspirin, 46, "Aspirin Rejuvination", true, aspirinicon, "Restore a portion of your life over time.", 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, aspirinui, 30f, 1.5f);
        AllSpells[46] = Aspirin;

        Spell Ibuprofen = new Spell();
        SpellSet(Ibuprofen, 47, "Ibuprophen Heal", true, ibuicon, "A 5 second cast heal spell.", 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ibui, 45f, 5f);
        AllSpells[47] = Ibuprofen;

        Spell Influenza = new Spell();
        SpellSet(Influenza, 48, "Influenza Cloud", true, influenzaicon, "Summon a miasma of influenza directly in front of the caster, dealing damage over time.", 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, influenzaui, 10f, 2f);
        AllSpells[48] = Influenza;

        Spell ChlorineGas = new Spell();
        SpellSet(ChlorineGas, 49, "Chlorine Gas Cloud", false, chlorinegasicon, "Summon a chlorine gas cloud, covering a large area and dealing a bit of damage over time to enemies.", 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, chlorinegasui, 15f, 3f);
        AllSpells[49] = ChlorineGas;

        Spell Myoglobin = new Spell ();
        SpellSet (Myoglobin, 50, "Myoglobin Scimitar", true, myoglobicon, "Sacrifice 10% of your maximum HP to summon a blood scimitar, which swings once and deals damage.", 13, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, myoglobui, 0.7f, 0f);
        AllSpells [50] = Myoglobin;

        /* ---- ITEMS ---- */
        // Health potion
        Item hpot = new Item();
        ItemSet(hpot, 0, hpotui, "Health Potion", "Consumable", "A consumable health elixir. Restores 40 health.\n\nInvented by the biochemists of Kratzoff, this concoction of known restorative herbs and drugs allows temporary relief of pain.", false, 40, 0, false, false, 0);
        AllItems[0] = hpot;

        // Stamina potion
        Item spot = new Item();
        ItemSet(spot, 1, stampotui, "Stamina Potion", "Consumable", "A consumable stamina elixir that grants 40 stamina the cost of 20 health.\n\nA highly concentrated solution of ethanol, with a strong aromatic flavoring added to cover up the smell. Alcoholic beverages were quickly discovered to allow for more spellcasts on Synthuses. The exact chemical mechanism of this phenomenon is unknown, but many speculate that it has to do with the ethereal psychological link between the Syntus and its user.", false, -20, 40, false, false, 0);
        AllItems[1] = spot;

        Item smallchime = new Item();
        ItemSet(smallchime, 2, smallchimeui, "Small Resonant Chime", "Resonant", "Ring the chime to resonate with the Multiverse.\nThis small chime should grant a small amount of soul energy for the Synthus.\nWhen the chime is rung, the soul energies of alternate universes can be resonated with and brought to this universe. To compensate for the energy gained in this universe, the chime is completely consumed. Resonant instruments are quite rare and expensive and are crafted in a very special way such that the inaudible sound they produce can resonate with the Multiverse.", false, 0, 0, false, false, 300);
        AllItems[2] = smallchime;

        Item chlorinereactable = new Item();
        ItemSet(chlorinereactable, 3, chemicalui, "Concentrated Chlorine", "Reactable", "A highly concentrated solution of chlorine. The container is highly pressurized and as a result the Chlorine is in its liquid state. Halogenation reactions are often performed rather easily with more concentrated solutions like these.", false, 0, 0, false, false, 0);
        AllItems[3] = chlorinereactable;

        Item Lithium_Hydroxide = new Item();
        ItemSet(Lithium_Hydroxide, 4, chemicalui, "Lithium Hydroxide", "Reactable", "A highly concentrated solution of Lithium Hydroxide. It would make a perfect electrolyte for a Lithium battery cell. Lithium hydroxide is often mass produced in inorganic societies, and as a result has spread across the land.", false, 0, 0, false, false, 0);
        AllItems[4] = Lithium_Hydroxide;

        Item culture = new Item();
        ItemSet(culture, 5, chemicalui, "Culture Catalyst", "Reactable", "A collection of special minerals and nutrients that are said to speed up the growth of certain microbiological cultures. It is a shame that so much effort was put into the development of deadly diseases and organisms by biochemists instead of researching medicine for their fellow man.", true, 0, 0, false, false, 0);
        AllItems[5] = culture;

        Item key1 = new Item();
        ItemSet(key1, 6, key1ui, "Castle Courtyard Key", "Key", "A master key to the courtyard of Castle Vod. Castle Vod, originating from the Cosmosian word for 'Life', is supposedly devoted to study the life aspects of water. As a result, water is seen as a holy medium in the region, and is believed to be the most important gift from hyperspace and Phota, the giver of life.", false, 0, 0, false, true, 0);
        AllItems[6] = key1;

        Item key2 = new Item();
        ItemSet(key2, 7, key2ui, "Ornate Key", "Key", "An ornate looking key, possibly only carried by high ranking members of Vod.\nOnly the most elite of the Vodists know of the Magister's secrets, which are hidden away in the courtyard shack. Only high ranking officers are ever seen entering or exiting it.", false, 0, 0, false, true, 0);
        AllItems[7] = key2;

        Item abominationsoul = new Item();
        ItemSet(abominationsoul, 8, boss1soului, "Lifeless Soul", "Soul", "Soul essence of the Lifeless Abomination, the mysterious creature lurking in the Castle Vod Undercroft. It is nothing at all like a human soul, or like any living creature's soul.\n\nEspecially large souls have a hard time funneling into the Synthus, and need to be physically crushed to give it that final push. Use to gain a large amount of Energy or save to use for making new Spells at the Lab.", false, 0, 0, false, false, 800);
        AllItems[8] = abominationsoul;

        Item key3 = new Item();
        ItemSet(key3, 9, key3ui, "Dormitory Key", "Key", "Key to the front door of the Dormitories of Castle Vod. The floors are ordered in accordance to rank. Even the highest ranking Aqua Regia are known to live with minimal opulence. The Magister of each Castle usually resides in a seperate building from the others.", false, 0, 0, false, true, 0);
        AllItems[9] = key3;

        Item key4 = new Item ();
        ItemSet (key4, 10, key3ui, "Ophelia's Key", "Key", "Key to Ophelia's room.", false, 0, 0, false, true, 0);
        AllItems [10] = key4;

        Item synthus = new Item ();
        ItemSet (synthus, 11, synthusui, "Synthus", "", "Crush the Synthus to consume all of your energy and reappear in a parallel universe at the previous checkpoint. \nNicknamed the 'Soul Synthus', the mechanism behind how this device turns chemicals into weapons is still a mystery. The user is also said to have quantum immortality and the power to absorb the soul essences of others, two phenomena that are still shrouded in mystery. Although very fragile, its ability to grow in power and to be easily mass produced make it the strongest chemical weapon ever conceived.", false, -50000, 0, false, false, 0);
        AllItems [11] = synthus;

        Item TowerKey = new Item();
        ItemSet(TowerKey, 12, key4ui, "Tower Key", "Key", "Key to the western Vod Tower and adobe of the Magister.", false, 0, 0, false, true, 0);
        AllItems[12] = TowerKey;

        Item goldpendant = new Item();
        ItemSet(goldpendant, 13, pendantui, "Gold Pendant", "Key", "A very expensive looking pendant, likely belonging to the Magister of Castle Vod. Magisters of Regia Castles usually come from a long line of nobility, and it is said that each line passes along a knightly piece of jewelry to complete the coronation.", false, 0, 0, false, true, 0);
        AllItems[13] = goldpendant;

        Item bloodykey = new Item();
        ItemSet(bloodykey, 14, key3ui, "Blood Stained Key", "Key", "A blood stained dormitory key, belonging to the biochemist Aslan of the West who was temporarily performing joint research with the Vod. Biochemists often require the use of their own blood to cast most Synthus spells, as a result the state of their belongings after combat may become a bit messy.", false, 0, 0, false, true, 0);
        AllItems[14] = bloodykey;

        Item ritualsitekey = new Item();
        ItemSet(ritualsitekey, 15, key2ui, "Ritual Site Key", "Key", "Key to the Vod ritual site. Castle Vod is the only Regia establishment with a large open area dubbed a 'Ritual Site'. The Site was constructed by special request of the Magister. Its function is unknown", false, 0, 0, false, true, 0);
        AllItems[15] = ritualsitekey;

        Item squidsoul = new Item();
        ItemSet(squidsoul, 16, boss1soului, "Squid Soul", "Soul", "Soul essence of the Lifeless Abomination, the mysterious creature lurking in the Castle Vod Undercroft. It is nothing at all like a human soul, or like any living creature's soul.\n\nEspecially large souls have a hard time funneling into the Synthus, and need to be physically crushed to give it that final push. Use to gain a large amount of Energy or save to use for making new Spells at the Lab.", false, 0, 0, false, false, 800);
        AllItems[16] = squidsoul;

        /* ---- HATS ---- */
        Hat redHat = new Hat();
        HatSet(redHat, 0, "Crimson Crusader Topper", "A hat worn by the group known as the crimson crusaders who were renowned for their undetakings in blood chemistry. Formerly Regia disciples who focused on biochemistry, very little is known about those who experiment with blood. There are tales of Crimson Crusaders who had the ability to completely pop every artery of their enemies, but such stories are believed to be fictitious.", redhatui, hatredoverworld, hatredbig);
        AllHats[0] = redHat;

        Hat blueHat = new Hat();
        HatSet(blueHat, 1, "Aqua Regia Hat", "Hat worn by the disciples of Aqua Regia, who devote their life to studying the properties of water, due to its importance in nature. The Regia people were once known as peaceful nomads, and have built several castles and villages across the land as they hope to spread their beliefs of water. Recent developments in discoveries about using water as an effective weapon have changed that, however.", bluehatui, hatdefault, bluehatbig);
        AllHats[1] = blueHat;

        Hat brownHat = new Hat();
        HatSet(brownHat, 2, "Sancta Hat", "Worn by low ranking disciples of Sancta. Followers of the Sanct have a very strict intolerance to the chemical magics. Instead, they worship the Sancta Choir, a mysterious group of high ranking members of the Sanct whose singing is said to somehow destructively interfere with the Synthus.", brownhaticon, brownhatig, brownhatbig);
        AllHats[2] = brownHat;

        Hat blueber = new Hat();
        HatSet(blueber, 3, "Kratzhoff Beret", "Beret and Mask worn by the Kratzhoff, a people who are said to live in the far West. They are most notorious for their aptitude in Biochemistry and healing. It is said that Kratzhoff encampments are the final beacons of Healing and Repose for humanity, amongst the seemingly endless Wars. The mask is said to distance the healer from the disease of their patient.", bluebereticon, blueberetig, blueberetbig);
        AllHats[3] = blueber;

        /* --- TUNICS --- */
        Tunic vest1 = new Tunic();
        TunicSet(vest1, 0, tunicui, "Tattered Tunic", "Old tunic that has very limited defensive capabilities. Leather tunics have been produced for several centuries now, due to their moderate defensive capabilities and relatively high flexibility. This particular one seems to have been worn out by some sort of battle.", 0.1f, -0.1f, 0);
        AllTunics[0] = vest1;

        Tunic nullVest = new Tunic();
        TunicSet(nullVest, 1, nullui, "", "", 0f, 0f, 0f);
        AllTunics[1] = nullVest;

        /* -- AMULETS -- */
        Amulet ammy1 = new Amulet();
        AmuletSet(ammy1, 0, sapphui, "Sapphire Amulet", "Amulet embedded with a sapphire. Quite common amongst aqua regia soldiers. The sapphire was thought to contain secrets in the studies of water, but was later found out that its distinctive color was simply due to impurities of the Aluminum Oxide that it contains.", 0.01f, 500f);
        AllAmulets[0] = ammy1;

        Amulet nullAmmy = new Amulet();
        AmuletSet(nullAmmy, 1, nullui, "", "", 0.025f, 100000f);
        AllAmulets[1] = nullAmmy;

        EquippedAmulet = 1;
        EquippedHat = 1;
        EquippedTunic = 1;
    }
        public static bool LoadDisplayFields_Prefix(ref Hat __instance, ref bool __result)
        {
            try
            {
                if (__instance.Name == null)
                {
                    __result = false;
                    return(false);
                }
                foreach (KeyValuePair <int, string> keyValuePair in Game1.content.Load <Dictionary <int, string> >("Data\\hats"))
                {
                    string[] strArray = keyValuePair.Value.Split('/');
                    if (strArray[0] == __instance.Name)
                    {
                        __instance.displayName = __instance.Name;
                        if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.en)
                        {
                            __instance.displayName = strArray[strArray.Length - 1];
                        }
                        __instance.description = $"{strArray[1]}\n\nDeluxe Hats:\n";
                        __result = true;
                        switch (strArray[0])
                        {
                        case CowboyHat.Name:
                            __instance.description += CowboyHat.Description;
                            break;

                        case BowlerHat.Name:
                            __instance.description += BowlerHat.Description;
                            break;

                        case TopHat.Name:
                            __instance.description += TopHat.Description;
                            break;

                        case Sombrero.Name:
                            __instance.description += Sombrero.Description;
                            break;

                        case StrawHat.Name:
                            __instance.description += StrawHat.Description;
                            break;

                        case OfficialCap.Name:
                            __instance.description += OfficialCap.Description;
                            break;

                        case BlueBonnet.Name:
                            __instance.description += BlueBonnet.Description;
                            break;

                        case PlumChapeau.Name:
                            __instance.description += PlumChapeau.Description;
                            break;

                        case SkeletonMask.Name:
                            __instance.description += SkeletonMask.Description;
                            break;

                        case GoblinMask.Name:
                            __instance.description += GoblinMask.Description;
                            break;

                        case ChickenMask.Name:
                            __instance.description += ChickenMask.Description;
                            break;

                        case Earmuffs.Name:
                            __instance.description += Earmuffs.Description;
                            break;

                        case DelicateBow.Name:
                            __instance.description += DelicateBow.Description;
                            break;

                        case Tropiclip.Name:
                            __instance.description += Tropiclip.Description;
                            break;

                        case ButterflyBow.Name:
                            __instance.description += ButterflyBow.Description;
                            break;

                        case HuntersCap.Name:
                            __instance.description += HuntersCap.Description;
                            break;

                        case TruckerHat.Name:
                            __instance.description += TruckerHat.Description;
                            break;

                        case SailorsCap.Name:
                            __instance.description += SailorsCap.Description;
                            break;

                        case GoodOlCap.Name:
                            __instance.description += GoodOlCap.Description;
                            break;

                        case Fedora.Name:
                            __instance.description += Fedora.Description;
                            break;

                        case CoolCap.Name:
                            __instance.description += CoolCap.Description;
                            break;

                        case LuckyBow.Name:
                            __instance.description += LuckyBow.Description;
                            break;

                        case PolkaBow.Name:
                            __instance.description += PolkaBow.Description;
                            break;

                        case GnomesCap.Name:
                            __instance.description += GnomesCap.Description;
                            break;

                        case EyePatch.Name:
                            __instance.description += EyePatch.Description;
                            break;

                        case SantaHat.Name:
                            __instance.description += SantaHat.Description;
                            break;

                        case Tiara.Name:
                            __instance.description += Tiara.Description;
                            break;

                        case HardHat.Name:
                            __instance.description += HardHat.Description;
                            break;

                        case Souwester.Name:
                            __instance.description += Souwester.Description;
                            break;

                        case Daisy.Name:
                            __instance.description += Daisy.Description;
                            break;

                        case WatermelonBand.Name:
                            __instance.description += WatermelonBand.Description;
                            break;

                        case MouseEars.Name:
                            __instance.description += MouseEars.Description;
                            break;

                        case CatEars.Name:
                            __instance.description += CatEars.Description;
                            break;

                        case CowgalHat.Name:
                            __instance.description += CowgalHat.Description;
                            break;

                        case CowpokeHat.Name:
                            __instance.description += CowpokeHat.Description;
                            break;

                        case ArchersCap.Name:
                            __instance.description += ArchersCap.Description;
                            break;

                        case PandaHat.Name:
                            __instance.description += PandaHat.Description;
                            break;

                        case BlueCowboyHat.Name:
                            __instance.description += BlueCowboyHat.Description;
                            break;

                        case RedCowboyHat.Name:
                            __instance.description += RedCowboyHat.Description;
                            break;

                        case ConeHat.Name:
                            __instance.description += ConeHat.Description;
                            break;

                        case LivingHat.Name:
                            __instance.description += LivingHat.Description;
                            break;

                        case EmilysMagicHat.Name:
                            __instance.description += EmilysMagicHat.Description;
                            break;

                        case MushroomCap.Name:
                            __instance.description += MushroomCap.Description;
                            break;

                        case DinosaurHat.Name:
                            __instance.description += DinosaurHat.Description;
                            break;

                        case TotemMask.Name:
                            __instance.description += TotemMask.Description;
                            break;

                        case LogoCap.Name:
                            __instance.description += LogoCap.Description;
                            break;

                        case WearableDwarfHelm.Name:
                            __instance.description += WearableDwarfHelm.Description;
                            break;

                        case FashionHat.Name:
                            __instance.description += FashionHat.Description;
                            break;

                        case PumpkinMask.Name:
                            __instance.description += PumpkinMask.Description;
                            break;

                        case HairBone.Name:
                            __instance.description += HairBone.Description;
                            break;

                        case KnightsHelmet.Name:
                            __instance.description += KnightsHelmet.Description;
                            break;

                        case SquiresHelmet.Name:
                            __instance.description += SquiresHelmet.Description;
                            break;

                        case SpottedHeadscarf.Name:
                            __instance.description += SpottedHeadscarf.Description;
                            break;

                        case Beanie.Name:
                            __instance.description += Beanie.Description;
                            break;

                        case FishingHat.Name:
                            __instance.description += FishingHat.Description;
                            break;

                        case BlobfishMask.Name:
                            __instance.description += BlobfishMask.Description;
                            break;

                        case PartyHat.Name:
                            __instance.description += PartyHat.Description;
                            break;

                        case ArcaneHat.Name:
                            __instance.description += ArcaneHat.Description;
                            break;

                        case ChefHat.Name:
                            __instance.description += ChefHat.Description;
                            break;

                        case PirateHat.Name:
                            __instance.description += PirateHat.Description;
                            break;

                        case FlatToppedHat.Name:
                            __instance.description += FlatToppedHat.Description;
                            break;

                        case ElegantTurban.Name:
                            __instance.description += ElegantTurban.Description;
                            break;

                        case WhiteTurban.Name:
                            __instance.description += WhiteTurban.Description;
                            break;

                        case GarbageHat.Name:
                            __instance.description += GarbageHat.Description;
                            break;

                        case GoldenMask.Name:
                            __instance.description += GoldenMask.Description;
                            break;

                        case PropellerHat.Name:
                            __instance.description += PropellerHat.Description;
                            break;

                        case BridalVeil.Name:
                            __instance.description += BridalVeil.Description;
                            break;

                        case WitchHat.Name:
                            __instance.description += WitchHat.Description;
                            break;

                        case CopperPan.Name:
                            __instance.description += CopperPan.Description;
                            break;

                        case GreenTurban.Name:
                            __instance.description += GreenTurban.Description;
                            break;

                        case MagicCowboyHat.Name:
                            __instance.description += MagicCowboyHat.Description;
                            break;

                        case MagicTurban.Name:
                            __instance.description += MagicTurban.Description;
                            break;

                        default:
                            __instance.description += "No effect.";
                            break;
                        }
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                HatService.Monitor.Log($"Failed in {nameof(LoadDisplayFields_Prefix)}:\n{ex}");
                return(true);
            }
        }
Exemple #18
0
    // Method
    public void Randomize()
    {
        List<Eyes> eyes = new List<Eyes>();
        foreach (Eyes e in Clothing.Eyes)
            eyes.Add(e);
        this.eyes = eyes[Random.Range(0, eyes.Count - 1)];

        List<Gloves> gloves = new List<Gloves>();
        foreach (Gloves g in Clothing.Gloves)
            gloves.Add(g);
        this.gloves = gloves[Random.Range(0, gloves.Count - 1)];

        List<Pant> pant = new List<Pant>();
        foreach (Pant p in Clothing.Pants)
            pant.Add(p);
        this.pant = pant[Random.Range(0, pant.Count - 1)];

        List<Tshirt> tshirt = new List<Tshirt>();
        foreach (Tshirt t in Clothing.Tshirts)
            tshirt.Add(t);
        this.tshirt = tshirt[Random.Range(0, tshirt.Count - 1)];

        List<Body> body = new List<Body>();
        foreach (Body b in Clothing.Bodies)
            body.Add(b);
        this.body = body[Random.Range(0, body.Count - 1)];

        List<Hair> hair = new List<Hair>();
        foreach (Hair h in Clothing.Hairs)
            hair.Add(h);
        this.hair = hair[Random.Range(0, hair.Count - 1)];

        if (this.hair.GetTypeHair == Hair.TypeHair.Crete)
            this.hat = Hat.NoneHat;
        else
        {
            List<Hat> hat = new List<Hat>();
            foreach (Hat h in Clothing.Hats)
                hat.Add(h);
            this.hat = hat[Random.Range(0, hat.Count - 1)];
        }

        List<Beard> beard = new List<Beard>();
        foreach (Beard b in Clothing.Beards)
            beard.Add(b);
        this.beard = beard[Random.Range(0, beard.Count - 1)];
    }
Exemple #19
0
 private void HatSet(Hat hat, int id, string name, string descrip, Texture2D icon, Sprite ingame, Texture2D bs)
 {
     hat.hatID = id;
     hat.hatName = name;
     hat.hatDescrip = descrip;
     hat.HatIcon = icon;
     hat.HatInGame = ingame;
     hat.HatBigSprite = bs;
 }
Exemple #20
0
 public Hat(Hat hat)
     : base(hat)
 {
     this.color = hat.color;
     this.type = hat.type;
 }
Exemple #21
0
        public List<BaseItem> GetAllItemsInNpcBag(byte bag, int npcId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag);
            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId);
            characterIdParameter.DbType = DbType.Int32;

            List<BaseItem> items = new List<BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_PRICE = reader.GetOrdinal(DbNames.ITEM_PRICE);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_DURABILITY = reader.GetOrdinal(DbNames.ITEM_DURABILITY);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_MAXIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if(BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon)
                    {
                        b = new Hammer();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.Durability = reader.GetInt32(ordinalITEM_DURABILITY);
                    e.MaxDurability = e.Durability;
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUETRIES);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_PRICE);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return items;
        }
Exemple #22
0
 public static void ChangeHat(Hat hat, GameObject character)
 {
     foreach (Transform t in character.transform.FindChild("Character").FindChild("Armature").FindChild("Head_slot").FindChild("Hat"))
     {
         if (t.gameObject.name == hat.GetTypeHat.ToString())
         {
             t.gameObject.SetActive(true);
             t.gameObject.GetComponentInChildren<Renderer>().material.mainTexture = hat.Texture;
         }
         else
             t.gameObject.SetActive(false);
     }
 }
Exemple #23
0
 public virtual void Start()
 {
     hat = GetComponent <Hat>();
 }
        public BaseItem GetRebirthPillDrop(Monster m)
        {
            DbParameter levelParameter = _db.CreateParameter(DbNames.GETPILLDROPITEM_LEVEL_PARAMETER, m.Level);
            levelParameter.DbType = DbType.Int32;

            List<BaseItem> items = new List<BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETPILLDROPITEM_STOREDPROC, CommandType.StoredProcedure, levelParameter);

            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.DROPITEM_DURABILITY);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);
            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt32(ordinalITEM_MAXDURA);
                    e.MaxDurability = reader.GetInt32(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt32(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt32(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }
                    if (BKind == (byte)bKindBooks.RebirdBook)
                    {
                        b = new RebirthBook();
                    }
                    if (BKind == (byte)bKindBooks.FourthBook)
                    {
                        b = new FourthBook();
                    }
                    if (BKind == (byte)bKindBooks.FeSkillBook)
                    {
                        b = new FeSkillBook();
                    }
                    if (BKind == (byte)bKindBooks.FeBook)
                    {
                        b = new FiveElementBook();
                    }
                    if (BKind == (byte)bKindBooks.FocusBook)
                    {
                        b = new FocusBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }
                if (BType == (byte)bType.StoreTag)
                {
                    b = new StoreTag();

                    StoreTag tag = b as StoreTag;
                    tag.TimeLeft = reader.GetInt16(ordinalITEM_MAXDURA);
                    tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA);
                }
                if (BType == (byte)bType.PetItem)
                {
                    if (BKind == (byte)bKindPetItems.Taming)
                        b = new TameItem();
                    if (BKind == (byte)bKindPetItems.Food)
                        b = new PetFood();
                    if (BKind == (byte)bKindPetItems.Potion)
                        b = new PetPotion();
                    if (BKind == (byte)bKindPetItems.Resurect)
                        b = new PetResurrectItem();

                    PetItem p = b as PetItem;
                    p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                }
                if (BType == (byte)bType.Pill)
                {
                    if (BKind == (byte)bKindPills.Rebirth)
                        b = new RebirthPill();

                    RebirthPill p = b as RebirthPill;
                    p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS);
                    p.ToRebirth = (byte)(p.RequiredRebirth + 1);
                    p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX);
                }

                b.ItemID = 0;
                b.OwnerID = 0;
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = 0;
                b.Slot = 0;
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = 1;
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
                items.Add(b);
            }

            reader.Close();
            _db.Close();

            if (items.Count > 0)
            {
                Random rand = new Random();
                int itemPos = rand.Next(0, items.Count);
                return items[itemPos];
            }
            else
                return null;
        }
Exemple #25
0
        internal static void removeElements()
        {
            OnBeforeRemoving(EventArgs.Empty);

            findElements();

            elements = new List <object>();
            elements.AddRange(attachements);
            elements.AddRange(storage);
            elements.AddRange(objects);
            elements.AddRange(animals);
            elements.AddRange(characters);

            if (Game1.player.hat is ISaveElement)
            {
                ISaveElement element            = (ISaveElement)Game1.player.hat;
                string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                string       type = getTypeName(element);

                string name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                Hat    replacement = (Hat)element.getReplacement();
                replacement.name = name;

                Game1.player.hat = (Hat)replacement;
            }


            if (Game1.player.boots is ISaveElement)
            {
                ISaveElement element            = (ISaveElement)Game1.player.boots;
                string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                string       type = getTypeName(element);

                string name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                Boots  replacement = (Boots)element.getReplacement();
                replacement.name = name;

                Game1.player.boots = (Boots)replacement;
            }

            if (Game1.player.leftRing is ISaveElement)
            {
                ISaveElement element            = (ISaveElement)Game1.player.leftRing;
                string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                string       type = getTypeName(element);

                string name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                Ring   replacement = (Ring)element.getReplacement();
                replacement.name = name;

                Game1.player.leftRing = (Ring)replacement;
            }

            if (Game1.player.rightRing is ISaveElement)
            {
                ISaveElement element            = (ISaveElement)Game1.player.rightRing;
                string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                string       type = getTypeName(element);

                string name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                Ring   replacement = (Ring)element.getReplacement();
                replacement.name = name;

                Game1.player.rightRing = (Ring)replacement;
            }


            for (int i = 0; i < elements.Count; i++)
            {
                if (elements[i] is List <Item> )
                {
                    List <Item> list = (List <Item>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] is ISaveElement)
                        {
                            ISaveElement element            = (ISaveElement)list[j];
                            string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string       type        = getTypeName(element);
                            string       name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                            Item         replacement = (Item)element.getReplacement();

                            if (replacement is StardewValley.Object obj)
                            {
                                obj.name = name;
                                list[j]  = obj;
                            }
                            else if (replacement is Tool tool)
                            {
                                tool.name = name;
                                list[j]   = tool;
                            }
                            else
                            {
                                list[j] = replacement;
                            }
                        }
                    }
                }
                else if (elements[i] is List <Furniture> )
                {
                    List <Furniture> list = (List <Furniture>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] is ISaveElement)
                        {
                            ISaveElement         element            = (ISaveElement)list[j];
                            string               additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string               type        = getTypeName(element);
                            string               name        = "CEHe/Item/" + type + "/" + additionalSaveData;
                            StardewValley.Object replacement = (StardewValley.Object)element.getReplacement();
                            replacement.name = name;


                            list[j] = (Furniture)replacement;
                        }
                    }
                }
                else if (elements[i] is SerializableDictionary <Vector2, StardewValley.Object> )
                {
                    SerializableDictionary <Vector2, StardewValley.Object> changes = new SerializableDictionary <Vector2, StardewValley.Object>();
                    SerializableDictionary <Vector2, StardewValley.Object> dict    = (SerializableDictionary <Vector2, StardewValley.Object>)elements[i];

                    foreach (Vector2 keyV in dict.Keys)
                    {
                        if (dict[keyV] is ISaveElement)
                        {
                            ISaveElement         element            = (ISaveElement)dict[keyV];
                            string               additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string               type        = getTypeName(element);
                            string               name        = "CEHe/Object/" + type + "/" + additionalSaveData;
                            StardewValley.Object replacement = (StardewValley.Object)element.getReplacement();
                            replacement.name = name;
                            changes.Add(keyV, (StardewValley.Object)replacement);
                        }
                    }

                    foreach (Vector2 keyV in changes.Keys)
                    {
                        dict[keyV] = changes[keyV];
                    }
                }
                else if (elements[i] is SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> )
                {
                    SerializableDictionary <Vector2, StardewValley.Object> changes = new SerializableDictionary <Vector2, StardewValley.Object>();
                    SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> dict = (SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature>)elements[i];

                    foreach (Vector2 keyV in dict.Keys)
                    {
                        if (dict[keyV] is ISaveElement)
                        {
                            ISaveElement         element            = (ISaveElement)dict[keyV];
                            string               additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string               type        = getTypeName(element);
                            string               name        = "CEHe/Terrain/" + type + "/" + additionalSaveData;
                            StardewValley.Object replacement = (StardewValley.Object)element.getReplacement();
                            replacement.name = name;
                            changes.Add(keyV, (StardewValley.Object)replacement);
                        }
                    }

                    SerializableDictionary <Vector2, StardewValley.Object> objectLayer = (SerializableDictionary <Vector2, StardewValley.Object>)elements[i - 1];

                    foreach (Vector2 keyV in changes.Keys)
                    {
                        dict[keyV] = new StardewValley.TerrainFeatures.Flooring(0);
                        if (objectLayer.ContainsKey(keyV))
                        {
                            objectLayer[keyV].name = changes[keyV].name + "#" + objectLayer[keyV].name;
                        }
                        else
                        {
                            objectLayer[keyV] = changes[keyV];
                        }
                    }
                }
                else if (elements[i] is SerializableDictionary <long, FarmAnimal> )
                {
                    SerializableDictionary <long, FarmAnimal> changes = new SerializableDictionary <long, FarmAnimal>();
                    SerializableDictionary <long, FarmAnimal> dict    = (SerializableDictionary <long, FarmAnimal>)elements[i];

                    foreach (long keyL in dict.Keys)
                    {
                        if (dict[keyL] is ISaveElement)
                        {
                            ISaveElement element            = (ISaveElement)dict[keyL];
                            string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string       type        = getTypeName(element);
                            string       name        = "CEHe/Animal/" + type + "/" + additionalSaveData;
                            FarmAnimal   replacement = (FarmAnimal)element.getReplacement();
                            replacement.name = name;

                            changes.Add(keyL, (FarmAnimal)replacement);
                        }
                    }

                    foreach (long keyL in changes.Keys)
                    {
                        dict[keyL] = changes[keyL];
                    }
                }
                else if (elements[i] is List <NPC> )
                {
                    List <NPC> list = (List <NPC>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] is ISaveElement)
                        {
                            ISaveElement element            = (ISaveElement)list[j];
                            string       additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string       type        = getTypeName(element);
                            string       name        = "CEHe/NPC/" + type + "/" + additionalSaveData;
                            NPC          replacement = (NPC)element.getReplacement();
                            replacement.name = name;
                            list[j]          = (NPC)replacement;
                        }
                    }
                }
                else if (elements[i] is StardewValley.Object[])
                {
                    StardewValley.Object[] list = (StardewValley.Object[])elements[i];
                    for (int j = 0; j < list.Length; j++)
                    {
                        if (list[j] is ISaveElement)
                        {
                            ISaveElement         element            = (ISaveElement)list[j];
                            string               additionalSaveData = string.Join("/", element.getAdditionalSaveData().Select(x => x.Key + "=" + x.Value));
                            string               type        = getTypeName(element);
                            string               name        = "CEHe/Attachement/" + type + "/" + additionalSaveData;
                            StardewValley.Object replacement = (StardewValley.Object)element.getReplacement();
                            replacement.name = name;
                            list[j]          = (StardewValley.Object)replacement;
                        }
                    }
                }
            }
            OnFinishedRemoving(EventArgs.Empty);
        }
        public List<BaseItem> GetAllItemsInBag(byte bag, int characterId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_BAGID_PARAMETER, bag);
            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_CHARACTERID_PARAMETER, characterId);
            characterIdParameter.DbType = DbType.Int32;

            List<BaseItem> items = new List<BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_IMBUEDATA = reader.GetOrdinal(DbNames.ITEM_IMBUEDATA);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_PETID = reader.GetOrdinal(DbNames.ITEM_PETID);
            int ordinalITEM_DAMAGEABSORB = reader.GetOrdinal(DbNames.ITEM_DAMAGEABSORB);
            int ordinalITEM_DEFENSEABSORB = reader.GetOrdinal(DbNames.ITEM_DEFENSEABSORB);
            int ordinalITEM_ATTACKRATINGABSORB = reader.GetOrdinal(DbNames.ITEM_ATTACKRATINGABSORB);
            int ordinalITEM_LIFEABSORB = reader.GetOrdinal(DbNames.ITEM_LIFEABSORB);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape || BType == (byte)bType.Mirror)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }
                    if (BType == (byte)bType.Mirror)
                    {
                        // bkind 4 = mirror, 0 = jar
                        b = new Mirror();
                        Mirror m = b as Mirror;

                        m.PetID = reader.GetInt32(ordinalITEM_PETID);
                        m.LifeAbsorb = reader.GetInt16(ordinalITEM_LIFEABSORB);
                        m.DamageAbsorb = reader.GetInt16(ordinalITEM_DAMAGEABSORB);
                        m.DefenseAbsorb = reader.GetInt16(ordinalITEM_DEFENSEABSORB);
                        m.AttackRatingAbsorb = reader.GetInt16(ordinalITEM_ATTACKRATINGABSORB);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt32(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt32(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt32(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt32(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt32(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetInt16(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    im.ImbueData = reader.GetByte(ordinalITEM_IMBUEDATA);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }
                    if (BKind == (byte)bKindBooks.RebirdBook)
                    {
                        b = new RebirthBook();
                    }
                    if (BKind == (byte)bKindBooks.FourthBook)
                    {
                        b = new FourthBook();
                    }
                    if (BKind == (byte)bKindBooks.FeSkillBook)
                    {
                        b = new FeSkillBook();
                    }
                    if (BKind == (byte)bKindBooks.FeBook)
                    {
                        b = new FiveElementBook();
                    }
                    if (BKind == (byte)bKindBooks.FocusBook)
                    {
                        b = new FocusBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }
                if (BType == (byte)bType.StoreTag)
                {
                    b = new StoreTag();

                    StoreTag tag = b as StoreTag;
                    tag.TimeLeft = reader.GetInt16(ordinalITEM_CURDURA);
                    tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA);
                }
                if (BType == (byte)bType.PetItem)
                {
                    if (BKind == (byte)bKindPetItems.Taming)
                        b = new TameItem();
                    if (BKind == (byte)bKindPetItems.Food)
                        b = new PetFood();
                    if (BKind == (byte)bKindPetItems.Potion)
                        b = new PetPotion();
                    if (BKind == (byte)bKindPetItems.Resurect)
                        b = new PetResurrectItem();

                    PetItem p = b as PetItem;
                    p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                }
                if (BType == (byte)bType.Pill)
                {
                    if (BKind == (byte)bKindPills.Rebirth)
                        b = new RebirthPill();

                    RebirthPill p = b as RebirthPill;
                    p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS);
                    p.ToRebirth = (byte)(p.RequiredRebirth + 1);
                    p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return items;
        }
Exemple #27
0
        public Team FilterTeam(bool hardFilter = false)
        {
            Team        t           = null;
            Profile     _profile    = DuckNetwork.profiles[profileBoxNumber];
            TeamSelect2 current     = Level.current as TeamSelect2;
            ProfileBox2 box         = current.GetBox((byte)profileBoxNumber);
            HatSelector hatSelector = box._hatSelector;

            if (!Network.isActive)
            {
                t = AllTeams()[(int)_desiredTeamSelection];
            }
            int index = (int)_desiredTeamSelection;

            if (index >= AllTeams().Count)
            {
                index = ControllerNumber();
            }
            if (_profile != null && _profile.connection == DuckNetwork.localConnection && !hardFilter)
            {
                if (index >= Teams.core.teams.Count)
                {
                    Team allTeam = AllTeams()[index];
                    index = ControllerNumber();
                }
                t = AllTeams()[index];
            }
            Team allTeam1;

            if (_profile.connection == DuckNetwork.localConnection)
            {
                if (index >= Teams.core.teams.Count)
                {
                    Team allTeam2 = AllTeams()[index];
                    allTeam1 = AllTeams()[ControllerNumber()];
                    Team.MapFacade(localID, allTeam2);
                    Send.Message((NetMessage) new NMSpecialHat(allTeam2, localID));
                }
                else
                {
                    allTeam1 = AllTeams()[index];
                    Team.ClearFacade(_profile.steamID);
                    Send.Message((NetMessage) new NMSpecialHat((Team)null, localID));
                }
            }
            else
            {
                allTeam1 = AllTeams()[index];
            }
            t = allTeam1;

            if (hardFilter == true)
            {
                if (Network.isActive && box.duck != null)
                {
                    Send.Message(new NMSetTeam(box.duck.profile.networkIndex, (byte)Teams.IndexOf(t)));
                }
                if (t.hasHat)
                {
                    if (box.duck != null)
                    {
                        Hat equipment = box.duck.GetEquipment(typeof(Hat)) as Hat;
                        Hat hat       = (Hat) new TeamHat(0.0f, 0.0f, t);
                        Level.Add((Thing)hat);
                        box.duck.Equip((Equipment)hat, false, false);
                        box.duck.Fondle((Thing)hat);
                        if (hatSelector.hat != null)
                        {
                            Level.Remove((Thing)hatSelector.hat);
                        }
                        hatSelector.hat = hat;
                        if (equipment != null)
                        {
                            Level.Remove((Thing)equipment);
                        }
                    }
                    else if (hatSelector.hat != null)
                    {
                        Level.Remove((Thing)hatSelector.hat);
                    }
                }
                else
                {
                    if (hatSelector.hat != null)
                    {
                        Level.Remove((Thing)hatSelector.hat);
                    }
                    hatSelector.hat = (Hat)null;
                    if (box.duck != null)
                    {
                        Hat equipment = box.duck.GetEquipment(typeof(Hat)) as Hat;
                        if (equipment != null)
                        {
                            box.duck.Unequip((Equipment)equipment, false);
                            Level.Remove((Thing)equipment);
                        }
                    }
                }
                if (_desiredTeamSelection <= 7)
                {
                    _desiredTeamSelection = 0;
                }
            }
            return(t);
        }
Exemple #28
0
        public void Entety_cant_have_others_attribute()
        {
            var alice = Factory.CreateAgent< IVirtual >().As< IVirtual >();
            var bob = Factory.CreateAgent< IVirtual >().As< IVirtual >();
            var hat = new Hat();

            alice.AddAttribute( hat );
            bob.AddAttribute( hat );
        }
Exemple #29
0
    void VerticalCollisions(ref Vector2 moveAmount)
    {
        float directionY = Mathf.Sign(moveAmount.y);
        float rayLength  = Mathf.Abs(moveAmount.y) + skinWidth;

        for (int i = 0; i < verticalRayCount; i++)
        {
            Vector2 rayOrigin = raycastOrigins.bottomLeft;
            rayOrigin += Vector2.right * (verticalRaySpacing * i + moveAmount.x);
            RaycastHit2D[] hits = Physics2D.RaycastAll(rayOrigin, Vector2.up * directionY, rayLength, collisionMask);
            Debug.DrawRay(rayOrigin, Vector2.up * directionY, Color.red);

            for (int j = 0; j < hits.Length; j++)
            {
                if (hits[j])
                {
                    if (hits[j].transform.gameObject == transform.gameObject)
                    {
                        continue;
                    }

                    if (hits[j].transform.CompareTag("Lava"))
                    {
                        if (cube.velocity.y < 0)
                        {
                            cube.Break();
                        }

                        continue;
                    }

                    if (hits[j].transform.CompareTag("Solid"))
                    {
                        if (cube.isDangerous)
                        {
                            cube.Break();
                        }

                        if (cube.velocity.y < 0)
                        {
                            cube.Break();
                        }
                    }

                    if (hits[j].transform.CompareTag("Hat"))
                    {
                        Hat otherHat = hits[j].transform.GetComponent <Hat>();

                        if (!otherHat.isBeingThrown)
                        {
                            otherHat.BlowBack(otherHat.transform.position - transform.position, cube.velocity.magnitude);
                        }
                    }

                    if (hits[j].transform.CompareTag("Player"))
                    {
                        Player otherPlayer = hits[j].transform.GetComponent <Player>();

                        if (cube.isDangerous)
                        {
                            Vector3 hitDirection = otherPlayer.transform.position - transform.position;
                            otherPlayer.BlowBack(hitDirection, 40, 0.2f);
                            cube.Break();
                        }
                        else if (cube.velocity.y >= 0)
                        {
                            continue;
                        }
                        if (cube.velocity.y < 0)
                        {
                            cube.Break();
                            otherPlayer.GetFootStooled(0.2f, false);
                        }
                    }

                    moveAmount.y = (hits[j].distance - skinWidth) * directionY;
                    rayLength    = hits[j].distance;

                    if (!hits[j].transform.CompareTag("Player") && !hits[j].transform.CompareTag("Hat") && hits[j].transform.gameObject != transform.gameObject)
                    {
                        collisions.below = directionY == -1;
                        collisions.above = directionY == 1;
                    }
                }
            }
        }
    }
Exemple #30
0
    public void RespondToTrendEvent(Hat newHat, float transmissionChance, float time, PlayerClass initiator)
    {
        Timer waitTimer = new Timer(time)
        {
          AutoReset = false,
        };
        waitTimer.Elapsed += (object sender, ElapsedEventArgs e) => RespondingToTrendEvent = true;
        waitTimer.Start();

        TrendEventHat = newHat;
        TrendEventInitiator = initiator;
        TrendEventTransmissionRate = transmissionChance;
    }
Exemple #31
0
 /// <summary>
 /// Sets the state of a hat depending on the given value.
 /// </summary>
 /// <param name="index">The hat which position should be changed.</param>
 /// <param name="value">The new state the hat should be changed to.</param>
 internal void SetHat(int index, Hat value)
 {
     _hats[index] = value;
 }
Exemple #32
0
    // Update is called once per frame
    protected virtual void Update()
    {
        Debug.DrawLine(transform.position, transform.position + Vector3.right * 3);
        // these must be done in main thread because they access UnityEngine's renderer
        if (AnimTriggerWaiting)
        {
          Anim.SetTrigger(AnimTriggerString);
          AnimTriggerWaiting = false;
        }

        // only npcs and the trend setter can cause trends
        if (TransformWaiting && ((tag == "Player" && GetComponent<PlayerClass>().playerClass == Class.TrendSetter) || tag != "Player"))
        {
          if(tag == "Player" && GetComponent<PlayerClass>().playerClass == Class.TrendSetter) {
        GetComponent<SFXPlayer>().PlaySFX("Crowd");
          }

          //Debug.Log(TransformTransmission);
          var furtherTransmissionChance = TransformTransmission * 0.5f - 0.05f;
          var nearbyObjects = GetObjectsInRadius(transform.position, 1);
          int trendCount = 0; // for counting how many you successfully influenced (trendsetter)
          foreach (var gameObject in nearbyObjects)
          {
        if (gameObject.tag != "Player"
            || (gameObject.GetComponent<PlayerClass>().playerClass == Class.BaldMan
            && !gameObject.GetComponent<PlayerClass>().immuneToTrends)) {
          var trend = gameObject.GetComponent<Trend>();

          if (trend != null && trend.CurrentHat != TransformHat && TransformTransmission > Random.value)
          {
            if (gameObject.tag == "Player"  && gameObject.GetComponent<PlayerClass>().playerClass == Class.BaldMan)
              furtherTransmissionChance = 0;

            trendCount++;
            trend.RespondToTrendEvent(TransformHat, furtherTransmissionChance, Random.Range(100,400), TransformInitiator);
          }
        }
          }

          if (tag == "Player")
          {
        GetComponent<PlayerClass>().HandleTrendSet(trendCount);
          }

          TransformWaiting = false;
        }

          if (HatWaiting)
        {
          if (CurrentHat != HatOnCall)
        StolenFromRecently = false;

          // hide all hats
          foreach (var hatObject in HatObjects.Values)
        hatObject.renderer.enabled = false;

          // display the new hat and update reference to the current hat
          if(HatOnCall != Hat.NoHat)
        HatObjects[HatOnCall].renderer.enabled = true;
          CurrentHat = HatOnCall;

          HatWaiting = false;
        }

        if (RespondingToTrendEvent)
        {
          RespondingToTrendEvent = false;
          if (CurrentHat != TrendEventHat) {
        //if(TrendEventInitiator != null && TrendEventInitiator.tag == "Player" && TrendEventInitiator.playerClass == Class.TrendSetter)
          //GetComponent<SFXPlayer>().PlaySFX("Crowd");
        ChangeHat(TrendEventHat, TrendEventTransmissionRate, TrendEventInitiator, GetComponent<PlayerClass>());
          }
        }

        if (StartingTrendEvent)
        {
          GetComponent<PlayerClass>().MakeTrendAnimation();
          ChangeHat(NewTrendEventHat, 1.0f, GetComponent<PlayerClass>(), GetComponent<PlayerClass>());
          StartingTrendEvent = false;
        }
    }
Exemple #33
0
        private void AssignParams(Dictionary <string, short> paramList)
        {
            if (paramList == null)
            {
                paramList = new Dictionary <string, short>();
            }

            this.FaceRight = paramList.ContainsKey("dir") && paramList["dir"] == 1 ? false : true;

            // Apply Head
            byte face = paramList.ContainsKey("face") ? (byte)paramList["face"] : (byte)0;

            if (face == 0)
            {
                HeadMap.LanaHead.ApplyHead(this, false);
            }
            if (face == 1)
            {
                HeadMap.RyuHead.ApplyHead(this, false);
            }
            else if (face == 2)
            {
                HeadMap.PooHead.ApplyHead(this, false);
            }
            else if (face == 3)
            {
                HeadMap.CarlHead.ApplyHead(this, false);
            }

            // Suit
            if (paramList.ContainsKey("suit") && paramList["suit"] > 0)
            {
                Suit.AssignToCharacter(this, ParamTrack.AssignSuitIDs[(byte)paramList["suit"]], true);
            }

            // Hat
            if (paramList.ContainsKey("hat") && paramList["hat"] > 0)
            {
                Hat.AssignToCharacter(this, ParamTrack.AssignHatIDs[(byte)paramList["hat"]], true);
            }

            // Shoes
            if (paramList.ContainsKey("shoes") && paramList["shoes"] > 0)
            {
                Shoes.AssignShoe(this, ParamTrack.AssignShoeIDs[(byte)paramList["shoes"]]);
            }

            // Mobility Power
            if (paramList.ContainsKey("mob") && paramList["mob"] > 0)
            {
                if (paramList["mob"] == 1)
                {
                    Power.RemoveMobilityPower(this);
                }
                Power.AssignPower(this, ParamTrack.AssignMobilityIDs[(byte)paramList["mob"]]);
            }

            // Attack Power
            byte attType = paramList.ContainsKey("att") ? (byte)paramList["att"] : (byte)0;

            // No Attack Power
            if (attType == 1)
            {
                Power.RemoveAttackPower(this);
            }

            // Weapon
            if (attType == 2)
            {
                byte power = paramList.ContainsKey("weapon") ? (byte)paramList["weapon"] : (byte)0;
                Power.AssignPower(this, ParamTrack.AssignWeaponIDs[power]);
            }

            // Spells
            if (attType == 3)
            {
                byte power = paramList.ContainsKey("spell") ? (byte)paramList["spell"] : (byte)0;
                Power.AssignPower(this, ParamTrack.AssignSpellsIDs[power]);
            }

            // Thrown
            if (attType == 4)
            {
                byte power = paramList.ContainsKey("thrown") ? (byte)paramList["thrown"] : (byte)0;
                Power.AssignPower(this, ParamTrack.AssignThrownIDs[power]);
            }

            // Bolts
            if (attType == 5)
            {
                byte power = paramList.ContainsKey("bolt") ? (byte)paramList["bolt"] : (byte)0;
                Power.AssignPower(this, ParamTrack.AssignBoltsIDs[power]);
            }

            this.stats.ResetCharacterStats();
        }
Exemple #34
0
 void OnTriggerStay2D(Collider2D c)
 {
     if (c.tag == "Hat")
     {
         hatInRange = true;
         closestHat = c.gameObject.GetComponent<Hat>();
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Skin != 0)
            {
                hash ^= Skin.GetHashCode();
            }
            if (Hair != 0)
            {
                hash ^= Hair.GetHashCode();
            }
            if (Shirt != 0)
            {
                hash ^= Shirt.GetHashCode();
            }
            if (Pants != 0)
            {
                hash ^= Pants.GetHashCode();
            }
            if (Hat != 0)
            {
                hash ^= Hat.GetHashCode();
            }
            if (Shoes != 0)
            {
                hash ^= Shoes.GetHashCode();
            }
            if (Avatar != 0)
            {
                hash ^= Avatar.GetHashCode();
            }
            if (Eyes != 0)
            {
                hash ^= Eyes.GetHashCode();
            }
            if (Backpack != 0)
            {
                hash ^= Backpack.GetHashCode();
            }
            if (AvatarHair.Length != 0)
            {
                hash ^= AvatarHair.GetHashCode();
            }
            if (AvatarShirt.Length != 0)
            {
                hash ^= AvatarShirt.GetHashCode();
            }
            if (AvatarPants.Length != 0)
            {
                hash ^= AvatarPants.GetHashCode();
            }
            if (AvatarHat.Length != 0)
            {
                hash ^= AvatarHat.GetHashCode();
            }
            if (AvatarShoes.Length != 0)
            {
                hash ^= AvatarShoes.GetHashCode();
            }
            if (AvatarEyes.Length != 0)
            {
                hash ^= AvatarEyes.GetHashCode();
            }
            if (AvatarBackpack.Length != 0)
            {
                hash ^= AvatarBackpack.GetHashCode();
            }
            if (AvatarGloves.Length != 0)
            {
                hash ^= AvatarGloves.GetHashCode();
            }
            if (AvatarSocks.Length != 0)
            {
                hash ^= AvatarSocks.GetHashCode();
            }
            if (AvatarBelt.Length != 0)
            {
                hash ^= AvatarBelt.GetHashCode();
            }
            if (AvatarGlasses.Length != 0)
            {
                hash ^= AvatarGlasses.GetHashCode();
            }
            if (AvatarNecklace.Length != 0)
            {
                hash ^= AvatarNecklace.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #36
0
 protected virtual void InitiateTrend(Hat trendyHat, float transmissionChance, PlayerClass initiator)
 {
     TransformHat = trendyHat;
     TransformTransmission = transmissionChance;
     TransformWaiting = true;
     TransformInitiator = initiator;
 }
        /// <summary>Get all items owned by the player.</summary>
        /// <remarks>
        /// This is derived from <see cref="Utility.iterateAllItems"/> with some improvements:
        ///   * removed items held by other players, items floating on the ground, spawned forage, and output in a non-ready machine (except casks which can be emptied anytime);
        ///   * added hay in silos;
        ///   * added tool attachments;
        ///   * added recursive scanning (e.g. inside held chests) to support mods like Item Bag.
        /// </remarks>
        public IEnumerable <FoundItem> GetAllOwnedItems()
        {
            List <FoundItem> items = new List <FoundItem>();

            // in locations
            foreach (GameLocation location in CommonHelper.GetLocations())
            {
                // furniture
                if (location is DecoratableLocation decorableLocation)
                {
                    foreach (Furniture furniture in decorableLocation.furniture)
                    {
                        this.ScanAndTrack(items, furniture, isRootInWorld: true);
                    }
                }

                // farmhouse fridge
                if (location is FarmHouse house)
                {
                    this.ScanAndTrack(items, house.fridge.Value, includeRoot: false);
                }

                // character hats
                foreach (NPC npc in location.characters)
                {
                    Hat hat =
                        (npc as Child)?.hat.Value
                        ?? (npc as Horse)?.hat.Value;
                    this.ScanAndTrack(items, hat);
                }

                // building output
                if (location is BuildableGameLocation buildableLocation)
                {
                    foreach (var building in buildableLocation.buildings)
                    {
                        switch (building)
                        {
                        case Mill mill:
                            this.ScanAndTrack(items, mill.output.Value, includeRoot: false);
                            break;

                        case JunimoHut hut:
                            this.ScanAndTrack(items, hut.output.Value, includeRoot: false);
                            break;
                        }
                    }
                }

                // map objects
                foreach (SObject item in location.objects.Values)
                {
                    if (item is Chest || !this.IsSpawnedWorldItem(item))
                    {
                        this.ScanAndTrack(items, item, isRootInWorld: true);
                    }
                }
            }

            // inventory
            this.ScanAndTrack(items, Game1.player.Items, isInInventory: true);
            this.ScanAndTrack(
                items,
                new Item[]
            {
                Game1.player.shirtItem.Value,
                Game1.player.pantsItem.Value,
                Game1.player.boots.Value,
                Game1.player.hat.Value,
                Game1.player.leftRing.Value,
                Game1.player.rightRing.Value
            },
                isInInventory: true
                );

            // hay in silos
            int hayCount = Game1.getFarm()?.piecesOfHay.Value ?? 0;

            while (hayCount > 0)
            {
                SObject hay = new SObject(178, 1);
                hay.Stack = Math.Min(hayCount, hay.maximumStackSize());
                hayCount -= hay.Stack;
                this.ScanAndTrack(items, hay);
            }

            return(items);
        }
Exemple #38
0
 // determines whether the character can change to a given hat at this time
 protected virtual bool CanChangeHat(Hat newHat)
 {
     return !HatOnCooldown;
 }
Exemple #39
0
 public void OnJoystickHatMoved(object sender, Hat hatArgs)
 {
     throw new NotImplementedException();
 }
Exemple #40
0
 //public Vector3 PlotTrajectoryAtTime(Vector2 start, Vector2 startVel, float time)
 //{
 //    // s = vi*t + (at^2)/2
 //    return start + startVel * time + (Physics2D.gravity * Mathf.Pow(time, 2) / 2);
 //}
 //public void PlotTrajectory(Vector2 start, Vector2 startVel, float timeStep, float maxTime)
 //{
 //}
 public void CancelHatMechanic(Hat currentHat)
 {
     switch (hatType)
     {
         case HatType.None:
             break;
         case HatType.Indian:
         case HatType.Jello:
             Destroy(currentHat.gameObject);
             if (jelloInGame)
                 Destroy(jelloInGame);
             break;
         case HatType.CandyCannon:
             Destroy(currentHat.gameObject);
             break;
         case HatType.Lollicopter:
             Destroy(currentHat.gameObject);
             break;
         default:
             break;
     }
 }
Exemple #41
0
 public void HatBack(Hat theHat)
 {
     hasHat = true;
     Destroy(theHat.gameObject);
 }
Exemple #42
0
        /// <summary>Raised as the day ends. Checks to see if it is raining. If it is, unequip rain equipment.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnDayEnding(object sender, DayEndingEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // ignore if the rainy clothes aren't loaded
            if (!this.Helper.ModRegistry.IsLoaded("IMS.Rainy.Day.Clothes"))
            {
                return;
            }

            // When it is raining, unequip Rain Hood, Coat, and Boots at end of day
            if (this.WeatherJustifiesRainCoat())
            {
                // Read what was previously equipped and equip it
                if (this.Config.RainCoatEnabled)
                {
                    Game1.player.changeShirt(this.previousShirt);
                }
                // if is currently wearing the rain hat, remove it
                if (this.Config.RainHoodEnabled)
                {
                    // Hood back DOWN
                    this.Helper.Content.InvalidateCache("Data/hats");
                    IDictionary <int, string> data = this.Helper.Content.Load <Dictionary <int, string> >("Data/hats", ContentSource.GameContent);
                    data[this.rainHatIndex] = "Rain Hood/Optional extra for your raincoat./true/false";
                    this.Helper.Content.InvalidateCache("Data/hats");

                    if (Game1.player.hat.Value.which.Value == this.rainHatIndex)
                    {
                        // if the player was previously wearing a hat, put it back , else take it off
                        if (this.isWearingHat)
                        {
                            Game1.player.changeHat(this.previousHatIndex);
                            // if the player has their previous hat in their inventory, remove it
                            Hat previousHat = new Hat(this.previousHatIndex);
                            if (Game1.player.hasItemInInventoryNamed(previousHat.Name))
                            {
                                Game1.player.removeItemFromInventory(Game1.player.hasItemWithNameThatContains(previousHat.Name));
                            }
                        }
                        else
                        {
                            Game1.player.hat.Value = null;
                        }
                    }
                    // If the player still has the rain hat in their inventory, remove it
                    Hat rainHat = new Hat(this.rainHatIndex);
                    if (Game1.player.hasItemInInventoryNamed(rainHat.Name))
                    {
                        Game1.player.removeItemFromInventory(Game1.player.hasItemWithNameThatContains(rainHat.Name));
                    }
                }

                if (this.Config.RainBootsEnabled)
                {
                    Boots rainBoots = new Boots(this.rainBootsIndex);
                    // Step 1 - take off rain boots
                    if (Game1.player.boots.Value.displayName == rainBoots.displayName)
                    {
                        Game1.player.boots.Value.onUnequip();
                    }
                    // Step 2 - equip previous boots
                    if (Game1.player.boots.Value.displayName == rainBoots.displayName)
                    {
                        if (this.previousBoots != null)
                        {
                            // if player has the previousBoots in their inventory, remove it
                            if (Game1.player.hasItemInInventoryNamed(this.previousBoots.Name))
                            {
                                Game1.player.removeItemFromInventory(Game1.player.hasItemWithNameThatContains(this.previousBoots.Name));
                            }
                            Game1.player.boots.Value = this.previousBoots;
                            Game1.player.boots.Value.onEquip();
                        }
                        else
                        {
                            // if player didn't have previousBoots, unequip the boots
                            Game1.player.boots.Value.onUnequip();
                            Game1.player.boots.Value = null;
                        }
                    }
                    // If the player still has the rain boots in their inventory, remove it
                    if (Game1.player.hasItemInInventoryNamed(rainBoots.Name))
                    {
                        Game1.player.removeItemFromInventory(Game1.player.hasItemWithNameThatContains(rainBoots.Name));
                    }
                }

                this.ResetPreviousData();
            }
        }
Exemple #43
0
        private void menuChanged(object sender, EventArgsClickableMenuChanged args)
        {
            if (args.NewMenu is TitleMenu)
            {
                resetAtTitle();
                return;
            }

            var  menu     = args.NewMenu as ShopMenu;
            bool hatMouse = false;

            if (menu != null && menu.potraitPersonDialogue == Game1.parseText(Game1.content.LoadString("Strings\\StringsFromCSFiles:ShopMenu.cs.11494"), Game1.dialogueFont, Game1.tileSize * 5 - Game1.pixelZoom * 4))
            {
                hatMouse = true;
            }
            if (menu == null || menu.portraitPerson == null && !hatMouse)
            {
                return;
            }

            //if (menu.portraitPerson.name == "Pierre")
            {
                Log.trace($"Adding objects to {menu.portraitPerson?.Name}'s shop");

                var forSale           = Helper.Reflection.GetField <List <Item> >(menu, "forSale").GetValue();
                var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <Item, int[]> >(menu, "itemPriceAndStock").GetValue();

                var precondMeth = Helper.Reflection.GetMethod(Game1.currentLocation, "checkEventPrecondition");
                foreach (var obj in objects)
                {
                    if (obj.Recipe != null && obj.Recipe.CanPurchase)
                    {
                        bool add = true;
                        // Can't use continue here or the item might not sell
                        if (obj.Recipe.PurchaseFrom != menu.portraitPerson?.Name || (obj.Recipe.PurchaseFrom == "HatMouse" && hatMouse))
                        {
                            add = false;
                        }
                        if (Game1.player.craftingRecipes.ContainsKey(obj.Name) || Game1.player.cookingRecipes.ContainsKey(obj.Name))
                        {
                            add = false;
                        }
                        if (obj.Recipe.PurchaseRequirements != null && obj.Recipe.PurchaseRequirements.Count > 0 &&
                            precondMeth.Invoke <int>(new object[] { obj.Recipe.GetPurchaseRequirementString() }) == -1)
                        {
                            add = false;
                        }
                        if (add)
                        {
                            var recipeObj = new StardewValley.Object(obj.id, 1, true, obj.Recipe.PurchasePrice, 0);
                            forSale.Add(recipeObj);
                            itemPriceAndStock.Add(recipeObj, new int[] { obj.Recipe.PurchasePrice, 1 });
                            Log.trace($"\tAdding recipe for {obj.Name}");
                        }
                    }
                    if (!obj.CanPurchase)
                    {
                        continue;
                    }
                    if (obj.PurchaseFrom != menu.portraitPerson?.Name || (obj.PurchaseFrom == "HatMouse" && hatMouse))
                    {
                        continue;
                    }
                    if (obj.PurchaseRequirements != null && obj.PurchaseRequirements.Count > 0 &&
                        precondMeth.Invoke <int>(new object[] { obj.GetPurchaseRequirementString() }) == -1)
                    {
                        continue;
                    }
                    Item item = new StardewValley.Object(Vector2.Zero, obj.id, int.MaxValue);
                    forSale.Add(item);
                    itemPriceAndStock.Add(item, new int[] { obj.PurchasePrice, int.MaxValue });
                    Log.trace($"\tAdding {obj.Name}");
                }
                foreach (var big in bigCraftables)
                {
                    if (big.Recipe != null && big.Recipe.CanPurchase)
                    {
                        bool add = true;
                        // Can't use continue here or the item might not sell
                        if (big.Recipe.PurchaseFrom != menu.portraitPerson?.Name || (big.Recipe.PurchaseFrom == "HatMouse" && hatMouse))
                        {
                            add = false;
                        }
                        if (Game1.player.craftingRecipes.ContainsKey(big.Name) || Game1.player.cookingRecipes.ContainsKey(big.Name))
                        {
                            add = false;
                        }
                        if (big.Recipe.PurchaseRequirements != null && big.Recipe.PurchaseRequirements.Count > 0 &&
                            precondMeth.Invoke <int>(new object[] { big.Recipe.GetPurchaseRequirementString() }) == -1)
                        {
                            add = false;
                        }
                        if (add)
                        {
                            var recipeObj = new StardewValley.Object(new Vector2(0, 0), big.id, true);
                            forSale.Add(recipeObj);
                            itemPriceAndStock.Add(recipeObj, new int[] { big.Recipe.PurchasePrice, 1 });
                            Log.trace($"\tAdding recipe for {big.Name}");
                        }
                    }
                    if (!big.CanPurchase)
                    {
                        continue;
                    }
                    if (big.PurchaseFrom != menu.portraitPerson?.Name || (big.PurchaseFrom == "HatMouse" && hatMouse))
                    {
                        continue;
                    }
                    if (big.PurchaseRequirements != null && big.PurchaseRequirements.Count > 0 &&
                        precondMeth.Invoke <int>(new object[] { big.GetPurchaseRequirementString() }) == -1)
                    {
                        continue;
                    }
                    Item item = new StardewValley.Object(Vector2.Zero, big.id, false);
                    forSale.Add(item);
                    itemPriceAndStock.Add(item, new int[] { big.PurchasePrice, int.MaxValue });
                    Log.trace($"\tAdding {big.Name}");
                }
                if (hatMouse)
                {
                    foreach (var hat in hats)
                    {
                        Item item = new Hat(hat.GetHatId());
                        forSale.Add(item);
                        itemPriceAndStock.Add(item, new int[] { hat.PurchasePrice, int.MaxValue });
                        Log.trace($"\tAdding {hat.Name}");
                    }
                }
            }

            (( Api )api).InvokeAddedItemsToShop();
        }
Exemple #44
0
 private static void JoystickOnHatMoved(IJoystick arg1, Hat arg2)
 {
     Console.WriteLine($"J{arg1.Index}> {arg2.Index} hat moved: {arg2.Position}");
 }
Exemple #45
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     foreach (ClickableComponent equipmentIcon in this.equipmentIcons)
     {
         if (equipmentIcon.containsPoint(x, y))
         {
             bool   flag = this.heldItem == null;
             string name = equipmentIcon.name;
             if (!(name == "Hat"))
             {
                 if (!(name == "Left Ring"))
                 {
                     if (!(name == "Right Ring"))
                     {
                         if (name == "Boots" && (this.heldItem == null || this.heldItem is Boots))
                         {
                             Boots heldItem = (Boots)this.heldItem;
                             this.heldItem      = (Item)Game1.player.boots;
                             Game1.player.boots = heldItem;
                             if (this.heldItem != null)
                             {
                                 (this.heldItem as Boots).onUnequip();
                             }
                             if (Game1.player.boots != null)
                             {
                                 Game1.player.boots.onEquip();
                                 Game1.playSound("sandyStep");
                                 DelayedAction.playSoundAfterDelay("sandyStep", 150);
                             }
                             else if (this.heldItem != null)
                             {
                                 Game1.playSound("dwop");
                             }
                         }
                     }
                     else if (this.heldItem == null || this.heldItem is Ring)
                     {
                         Ring heldItem = (Ring)this.heldItem;
                         this.heldItem          = (Item)Game1.player.rightRing;
                         Game1.player.rightRing = heldItem;
                         if (this.heldItem != null)
                         {
                             (this.heldItem as Ring).onUnequip(Game1.player);
                         }
                         if (Game1.player.rightRing != null)
                         {
                             Game1.player.rightRing.onEquip(Game1.player);
                             Game1.playSound("crit");
                         }
                         else if (this.heldItem != null)
                         {
                             Game1.playSound("dwop");
                         }
                     }
                 }
                 else if (this.heldItem == null || this.heldItem is Ring)
                 {
                     Ring heldItem = (Ring)this.heldItem;
                     this.heldItem         = (Item)Game1.player.leftRing;
                     Game1.player.leftRing = heldItem;
                     if (this.heldItem != null)
                     {
                         (this.heldItem as Ring).onUnequip(Game1.player);
                     }
                     if (Game1.player.leftRing != null)
                     {
                         Game1.player.leftRing.onEquip(Game1.player);
                         Game1.playSound("crit");
                     }
                     else if (this.heldItem != null)
                     {
                         Game1.playSound("dwop");
                     }
                 }
             }
             else if (this.heldItem == null || this.heldItem is Hat)
             {
                 Hat heldItem = (Hat)this.heldItem;
                 this.heldItem    = (Item)Game1.player.hat;
                 Game1.player.hat = heldItem;
                 if (Game1.player.hat != null)
                 {
                     Game1.playSound("grassyStep");
                 }
                 else if (this.heldItem != null)
                 {
                     Game1.playSound("dwop");
                 }
             }
             if (flag && this.heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
             {
                 for (int position = 0; position < Game1.player.items.Count; ++position)
                 {
                     if (Game1.player.items[position] == null || Game1.player.items[position].canStackWith(this.heldItem))
                     {
                         if (Game1.player.CurrentToolIndex == position && this.heldItem != null)
                         {
                             this.heldItem.actionWhenBeingHeld(Game1.player);
                         }
                         this.heldItem = Utility.addItemToInventory(this.heldItem, position, this.inventory.actualInventory, (ItemGrabMenu.behaviorOnItemSelect)null);
                         if (Game1.player.CurrentToolIndex == position && this.heldItem != null)
                         {
                             this.heldItem.actionWhenStopBeingHeld(Game1.player);
                         }
                         Game1.playSound("stoneStep");
                         return;
                     }
                 }
             }
         }
     }
     this.heldItem = this.inventory.leftClick(x, y, this.heldItem, !Game1.oldKBState.IsKeyDown(Keys.LeftShift));
     if (this.heldItem != null && this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).ParentSheetIndex == 434)
     {
         Game1.playSound("smallSelect");
         Game1.playerEatObject(this.heldItem as StardewValley.Object, true);
         this.heldItem = (Item)null;
         Game1.exitActiveMenu();
     }
     else if (this.heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
     {
         if (this.heldItem is Ring)
         {
             if (Game1.player.leftRing == null)
             {
                 Game1.player.leftRing = this.heldItem as Ring;
                 (this.heldItem as Ring).onEquip(Game1.player);
                 this.heldItem = (Item)null;
                 Game1.playSound("crit");
                 return;
             }
             if (Game1.player.rightRing == null)
             {
                 Game1.player.rightRing = this.heldItem as Ring;
                 (this.heldItem as Ring).onEquip(Game1.player);
                 this.heldItem = (Item)null;
                 Game1.playSound("crit");
                 return;
             }
         }
         else if (this.heldItem is Hat)
         {
             if (Game1.player.hat == null)
             {
                 Game1.player.hat = this.heldItem as Hat;
                 Game1.playSound("grassyStep");
                 this.heldItem = (Item)null;
                 return;
             }
         }
         else if (this.heldItem is Boots && Game1.player.boots == null)
         {
             Game1.player.boots = this.heldItem as Boots;
             (this.heldItem as Boots).onEquip();
             Game1.playSound("sandyStep");
             DelayedAction.playSoundAfterDelay("sandyStep", 150);
             this.heldItem = (Item)null;
             return;
         }
         if (this.inventory.getInventoryPositionOfClick(x, y) >= 12)
         {
             for (int position = 0; position < 12; ++position)
             {
                 if (Game1.player.items[position] == null || Game1.player.items[position].canStackWith(this.heldItem))
                 {
                     if (Game1.player.CurrentToolIndex == position && this.heldItem != null)
                     {
                         this.heldItem.actionWhenBeingHeld(Game1.player);
                     }
                     this.heldItem = Utility.addItemToInventory(this.heldItem, position, this.inventory.actualInventory, (ItemGrabMenu.behaviorOnItemSelect)null);
                     if (this.heldItem != null)
                     {
                         this.heldItem.actionWhenStopBeingHeld(Game1.player);
                     }
                     Game1.playSound("stoneStep");
                     return;
                 }
             }
         }
     }
     if (this.portrait.containsPoint(x, y))
     {
         this.portrait.name = this.portrait.name.Equals("32") ? "8" : "32";
     }
     if (this.heldItem != null && this.trashCan.containsPoint(x, y) && this.heldItem.canBeTrashed())
     {
         if (this.heldItem is StardewValley.Object && Game1.player.specialItems.Contains((this.heldItem as StardewValley.Object).parentSheetIndex))
         {
             Game1.player.specialItems.Remove((this.heldItem as StardewValley.Object).parentSheetIndex);
         }
         this.heldItem = (Item)null;
         Game1.playSound("trashcan");
     }
     else if (this.heldItem != null && !this.isWithinBounds(x, y) && this.heldItem.canBeTrashed())
     {
         Game1.playSound("throwDownITem");
         Game1.createItemDebris(this.heldItem, Game1.player.getStandingPosition(), Game1.player.FacingDirection, (GameLocation)null);
         this.heldItem = (Item)null;
     }
     if (this.organizeButton == null || !this.organizeButton.containsPoint(x, y))
     {
         return;
     }
     ItemGrabMenu.organizeItemsInList(Game1.player.items);
     Game1.playSound("Ship");
 }
Exemple #46
0
 private void SetHat(int index, Hat value)
 {
     _hats[index] = value;
 }
Exemple #47
0
        public LevelScene(bool grantCampaignEquipment) : base()
        {
            // Defaults
            this.isSinglePlayer = true;

            // UI State
            UIHandler.SetUIOptions(false, false);
            UIHandler.SetMenu(null, false);

            // Create UI
            this.levelUI = new LevelUI();

            // Generate Each Room Class
            this.rooms = new RoomScene[8];

            for (byte roomID = 0; roomID < Systems.handler.levelContent.data.rooms.Count; roomID++)
            {
                this.rooms[roomID] = new RoomScene(this, roomID);
            }

            // If we're on single player,
            Systems.localServer.ResetPlayers();

            // Restart the level, generate all rooms.
            this.RestartLevel(true);

            // Update Character with World Map abilities (if applicable)
            if (grantCampaignEquipment)
            {
                Character     character = Systems.localServer.MyCharacter;
                CampaignState campaign  = Systems.handler.campaignState;

                // Update Character Equipment
                if (campaign is CampaignState)
                {
                    if (character.suit is Suit == false || !character.suit.IsPowerSuit)
                    {
                        Suit.AssignToCharacter(character, campaign.suit, true);
                    }
                    if ((character.hat is Hat == false || !character.hat.IsPowerHat) && (character.hat == null || !character.hat.IsCosmeticHat || campaign.hat != 0))
                    {
                        Hat.AssignToCharacter(character, campaign.hat, true);
                    }
                    if (character.shoes is Shoes == false)
                    {
                        Shoes.AssignShoe(character, campaign.shoes);
                    }
                    if (character.attackPower is PowerAttack == false)
                    {
                        PowerAttack.AssignPower(character, campaign.powerAtt);
                    }
                    if (character.mobilityPower is PowerMobility == false)
                    {
                        PowerMobility.AssignPower(character, campaign.powerMob);
                    }
                    if (character.wounds.Health < campaign.health)
                    {
                        character.wounds.SetHealth(campaign.health);
                    }
                    if (character.wounds.Armor < campaign.armor)
                    {
                        character.wounds.SetArmor(campaign.armor);
                    }
                }
            }

            // Play or Stop Music
            Systems.music.Play((byte)Systems.handler.levelContent.data.music);
        }
Exemple #48
0
            /// <summary>Generates an item described by a saved object.</summary>
            /// <param name="save">A saved object descibing an item.</param>
            /// <param name="tile">The object's intended tile location. Generally necessary for items derived from StardewValley.Object.</param>
            public static Item CreateItem(SavedObject save, Vector2 tile = default(Vector2))
            {
                switch (save.Type) //check the object's type
                {
                case SavedObject.ObjectType.Object:
                case SavedObject.ObjectType.Item:
                case SavedObject.ObjectType.Container:
                case SavedObject.ObjectType.DGA:
                    //these are valid item types
                    break;

                default:
                    Monitor.Log($"Failed to create an item. Saved object does not appear to be an item.", LogLevel.Debug);
                    Monitor.Log($"Item name: {save.Name}", LogLevel.Debug);
                    return(null);
                }

                if (!save.ID.HasValue && save.Type != SavedObject.ObjectType.Container && save.Type != SavedObject.ObjectType.DGA) //if this save doesn't have an ID (and isn't a container or a DGA item)
                {
                    Monitor.Log("Failed to create an item. Saved object contained no ID.", LogLevel.Debug);
                    Monitor.Log($"Item name: {save.Name}", LogLevel.Debug);
                    return(null);
                }

                Item       item       = null;            //the item to be generated
                ConfigItem configItem = save.ConfigItem; //the ConfigItem class describing the item (null if unavailable)

                //parse container contents, if applicable
                List <Item> contents = new List <Item>();

                if (save.Type == SavedObject.ObjectType.Container)                                                //if this is a container
                {
                    string             areaID       = $"[unknown; parsing chest contents at {save.MapName}]";     //placeholder string; this method has no easy access to the areaID that created a given item
                    List <SavedObject> contentSaves = ParseSavedObjectsFromItemList(configItem.Contents, areaID); //parse the contents into saved objects for validation purposes

                    foreach (SavedObject contentSave in contentSaves)                                             //for each successfully parsed save
                    {
                        Item content = CreateItem(contentSave);                                                   //call this method recursively to create this item
                        if (content != null)                                                                      //if this item was created successfully
                        {
                            contents.Add(content);                                                                //add it to the contents list
                        }
                    }
                }

                string category = "item";

                if (configItem != null && configItem.Category != null)
                {
                    category = configItem.Category.ToLower();
                }

                switch (category) //based on the category
                {
                case "barrel":
                case "barrels":
                    item = new BreakableContainerFTM(tile, contents, true);     //create a mineshaft-style breakable barrel with the given contents
                    break;

                case "bigcraftable":
                case "bigcraftables":
                case "big craftable":
                case "big craftables":
                    item = new StardewValley.Object(tile, save.ID.Value, false);     //create an object as a "big craftable" item
                    break;

                case "boot":
                case "boots":
                    item = new Boots(save.ID.Value);
                    break;

                case "breakable":
                case "breakables":
                    bool barrel = RNG.Next(0, 2) == 0 ? true : false;     //randomly select whether this is a barrel or crate
                    if (configItem != null)
                    {
                        //rewrite the category to save the selection
                        if (barrel)
                        {
                            configItem.Category = "barrel";
                        }
                        else
                        {
                            configItem.Category = "crate";
                        }
                    }
                    item = new BreakableContainerFTM(tile, contents, barrel);     //create a mineshaft-style breakable container with the given contents
                    break;

                case "buried":
                case "burieditem":
                case "burieditems":
                case "buried item":
                case "buried items":
                    item = new BuriedItems(tile, contents);     //create an item burial location with the given contents
                    break;

                case "chest":
                case "chests":
                    item = new Chest(0, contents, tile, false, 0);     //create a mineshaft-style chest with the given contents
                    break;

                case "cloth":
                case "clothes":
                case "clothing":
                case "clothings":
                    item = new Clothing(save.ID.Value);
                    break;

                case "crate":
                case "crates":
                    item = new BreakableContainerFTM(tile, contents, false);     //create a mineshaft-style breakable crate with the given contents
                    break;

                case "dga":
                    try
                    {
                        object rawDGA = DGAItemAPI.SpawnDGAItem(save.Name); //create an item with DGA's API

                        if (rawDGA is Item itemDGA)                         //if this is a non-null Item
                        {
                            item = itemDGA;                                 //use it
                        }
                        else
                        {
                            Monitor.Log("Failed to create an item. Dynamic Game Assets (DGA) item was null or an unrecognized type.", LogLevel.Debug);
                            Monitor.Log($"Item name: {save.Name}", LogLevel.Debug);
                            return(null);
                        }
                    }
                    catch (Exception ex)
                    {
                        Monitor.LogOnce($"Error spawning a Dynamic Game Assets (DGA) item. The auto-generated error message has been added to the log.", LogLevel.Info);
                        Monitor.Log($"----------", LogLevel.Trace);
                        Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
                        return(null);
                    }
                    break;

                case "furniture":
                    item = new Furniture(save.ID.Value, tile);
                    break;

                case "hat":
                case "hats":
                    item = new Hat(save.ID.Value);
                    break;

                case "object":     //treat objects as items when creating them as Items
                case "objects":
                case "item":
                case "items":
                    item = new StardewValley.Object(tile, save.ID.Value, 1);     //create an object with the preferred constructor for "held" or "dropped" items
                    break;

                case "ring":
                case "rings":
                    item = new Ring(save.ID.Value);
                    break;

                case "weapon":
                case "weapons":
                    item = new MeleeWeapon(save.ID.Value);
                    break;
                }

                if (item == null) //if no item could be generated
                {
                    Monitor.Log("Failed to create an item. Category setting was not recognized.", LogLevel.Debug);
                    Monitor.Log($"Item Category: {category}", LogLevel.Debug);
                    return(null);
                }

                if (configItem?.Stack > 1)               //if this item has a custom stack setting
                {
                    item.Stack = configItem.Stack.Value; //apply it
                }

                if (save.ID.HasValue)                      //if this object type uses an ID
                {
                    item.ParentSheetIndex = save.ID.Value; //manually set this index value, due to it being ignored by some item subclasses
                }

                return(item);
            }
Exemple #49
0
        static public bool EquipmentClick(ClickableComponent icon)
        {
            // Check that item type is compatible.
            // And play corresponding sound.
            var helditem = Game1.player.CursorSlotItem;

            // Convert special items (such as copper pan & Lewis pants)
            if (helditem is StardewValley.Tools.Pan)
            {
                helditem = new Hat(71);
            }
            if (helditem is StardewValley.Object && helditem.ParentSheetIndex == 71)
            {
                helditem = new Clothing(15);
            }
            if (helditem == null)
            {
                if (icon.item == null)
                {
                    return(false);
                }
                Game1.playSound("dwop");
            }
            else
            {
                switch (icon.name)
                {
                case "Hat":
                    if (!(helditem is Hat))
                    {
                        return(false);
                    }
                    Game1.playSound("grassyStep");
                    break;

                case "Shirt":
                    if (!(helditem is Clothing))
                    {
                        return(false);
                    }
                    if ((helditem as Clothing).clothesType.Value != (int)Clothing.ClothesType.SHIRT)
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    break;

                case "Pants":
                    if (!(helditem is Clothing))
                    {
                        return(false);
                    }
                    if ((helditem as Clothing).clothesType.Value != (int)Clothing.ClothesType.PANTS)
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    break;

                case "Boots":
                    if (!(helditem is Boots))
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    DelayedAction.playSoundAfterDelay("sandyStep", 150, null);
                    break;

                default:
                    if (!(helditem is Ring))
                    {
                        return(false);
                    }
                    Game1.playSound("crit");
                    break;
                }
            }

            // I have no idea why StardewValley does this in InventoryPage::setHeldItem, but I guess it might be important.
            if (helditem != null)
            {
                helditem.NetFields.Parent = null;
            }

            // Update inventory
            ActualRings ar = actualdata.GetValue(Game1.player, FarmerNotFound);

            switch (icon.name)
            {
            case "Hat":          Game1.player.hat.Set(helditem as Hat);            break;

            case "Shirt":        Game1.player.shirtItem.Set(helditem as Clothing); break;

            case "Pants":        Game1.player.pantsItem.Set(helditem as Clothing); break;

            case "Boots":        Game1.player.boots.Set(helditem as Boots);        break;

            case "Left Ring":    Game1.player.leftRing.Set(helditem as Ring);      break;

            case "Right Ring":   Game1.player.rightRing.Set(helditem as Ring);     break;

            case "Extra Ring 1": ar.ring1.Set(helditem as Ring);                   break;

            case "Extra Ring 2": ar.ring2.Set(helditem as Ring);                   break;

            case "Extra Ring 3": ar.ring3.Set(helditem as Ring);                   break;

            case "Extra Ring 4": ar.ring4.Set(helditem as Ring);                   break;

            default:
                getInstance().Monitor.Log($"ERROR: Trying to fit equipment item into invalid slot '{icon.name}'", LogLevel.Error);
                return(false);
            }

            // Equip/unequip
            (icon.item as Ring)?.onUnequip(Game1.player, Game1.currentLocation);
            (icon.item as Boots)?.onUnequip();
            (helditem as Ring)?.onEquip(Game1.player, Game1.currentLocation);
            (helditem as Boots)?.onEquip();

            // Swap items
            Game1.player.CursorSlotItem = Utility.PerformSpecialItemGrabReplacement(icon.item);
            icon.item = helditem;
            return(true);
        }
Exemple #50
0
 public void TryChangeHat(Hat newHat)
 {
     if (CanChangeHat(newHat)) // check if the hat can be swapped
     {
       NewTrendEventHat = newHat;
       StartingTrendEvent = true;
     }
 }
Exemple #51
0
    void HorizontalCollisions(ref Vector2 moveAmount)
    {
        //if (hat.collisionSkip) return;
        Vector2 oldVelocity = cube.velocity;

        float directionX = (cube.velocity.x == 0) ? 0 : collisions.faceDir;

        float rayLength = Mathf.Abs(moveAmount.x) + skinWidth;

        if (Mathf.Abs(moveAmount.x) < skinWidth)
        {
            rayLength = 2 * skinWidth;
        }

        for (int i = 0; i < horizontalRayCount; i++)
        {
            Vector2 rayOrigin = (directionX == -1) ? raycastOrigins.bottomLeft : raycastOrigins.bottomRight;
            rayOrigin += Vector2.up * (horizontalRaySpacing * i);
            RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.right * directionX, rayLength, collisionMask);

            Debug.DrawRay(rayOrigin, Vector2.right * directionX, Color.red);

            if (hit)
            {
                if (hit.transform.gameObject == transform.gameObject)
                {
                    continue;
                }

                if (hit.distance == 0)
                {
                    //continue;
                }

                if (hit.collider.CompareTag("Ignore"))
                {
                    continue;
                }

                if (hit.collider.CompareTag("Solid"))
                {
                    if (!cube.isDangerous)
                    {
                        cube.Break();
                    }
                    else
                    {
                        collisions.shouldReflect = true;
                    }

                    continue;
                }

                if (hit.collider.CompareTag("Lava"))
                {
                    if (cube.velocity.y < 0)
                    {
                        cube.Break();
                    }

                    continue;
                }

                if (hit.collider.CompareTag("Player"))
                {
                    Player otherPlayer = hit.collider.GetComponent <Player>();

                    if (cube.isDangerous)
                    {
                        Vector3 hitDirection = ((Vector2)otherPlayer.transform.position - hit.point).normalized;
                        otherPlayer.BlowBack(hitDirection, 40, 0.2f);
                    }

                    if (cube.velocity.x > 1 || cube.velocity.x < -1)
                    {
                        cube.Break();
                    }
                }

                if (hit.collider.CompareTag("Hat"))
                {
                    Hat otherHat = hit.transform.GetComponent <Hat>();

                    if (!otherHat.isBeingThrown)
                    {
                        otherHat.BlowBack(otherHat.transform.position - transform.position, cube.velocity.magnitude);
                        cube.Break();
                    }
                }

                moveAmount.x = (hit.distance - skinWidth) * directionX;
                rayLength    = hit.distance;

                collisions.left  = directionX == -1;
                collisions.right = directionX == 1;

                if ((collisions.right || collisions.left))
                {
                    collisions.shouldReflect = true;
                }
            }
        }
    }
Exemple #52
0
 // Constructeur
 public Skin()
 {
     this.beard = new Beard();
     this.hair = new Hair();
     this.hat = new Hat();
     this.body = new Body();
     this.tshirt = new Tshirt();
     this.pant = new Pant();
     this.gloves = new Gloves();
     this.eyes = new Eyes();
 }
Exemple #53
0
        /*********
        ** Private methods
        *********/
        /// <summary>Raised after the day starts. Checks to see if it is raining. If yes, equips rain equipment.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // ignore if the rainy clothes aren't loaded
            if (!this.Helper.ModRegistry.IsLoaded("IMS.Rainy.Day.Clothes"))
            {
                return;
            }

            //When it is raining, equip Rain Hood, Coat, and Boots at start of day
            if (this.WeatherJustifiesRainCoat())
            {
                // Rain Coat!
                if (this.Config.RainCoatEnabled)
                {
                    // save current shirt for later retrieval (reequip at end of rainy day)
                    this.previousShirt = Game1.player.shirt.Value;
                    // Change current shirt to be rain coat!
                    Game1.player.changeShirt(this.Config.RaincoatClothingIndex - 1);
                }


                // Rain Hood!
                if (this.Config.RainHoodEnabled)
                {
                    // Make sure the hood is UP!
                    this.Helper.Content.InvalidateCache("Data/hats");
                    IDictionary <int, string> data = this.Helper.Content.Load <Dictionary <int, string> >("Data/hats", ContentSource.GameContent);
                    data[this.rainHatIndex] = "Rain Hood/Optional extra for your raincoat./false/false";
                    this.Helper.Content.InvalidateCache("Data/hats");

                    // Ensure hat is not null (no need to save hat if there is none!)
                    if (Game1.player.hat.Value != null)
                    {
                        // save current hat for later retrieval (reequip at end of rainy day)
                        this.isWearingHat     = true;
                        this.previousHatIndex = Game1.player.hat.Value.which.Value;
                        // put previous hat into player's inventory
                        Hat previousHat = new Hat(this.previousHatIndex);
                        if (Game1.player.isInventoryFull())
                        {
                            Game1.player.dropItem(previousHat);
                        }
                        else
                        {
                            Game1.player.addItemToInventory(new Hat(this.previousHatIndex));
                        }
                    }
                    // Replace hat with rain hood
                    Game1.player.changeHat(this.rainHatIndex);
                }

                // Rain Boots!
                if (this.Config.RainBootsEnabled)
                {
                    // Step 1 - take off old boots, put in player's inventory
                    if (Game1.player.boots.Value != null && Game1.player.boots.Value.displayName != new Boots(this.rainBootsIndex).displayName)
                    {
                        this.previousBoots = Game1.player.boots.Value;
                        Game1.player.boots.Value.onUnequip();
                        if (Game1.player.isInventoryFull())
                        {
                            Game1.player.dropItem(previousBoots);
                        }
                        else
                        {
                            Game1.player.addItemToInventory(previousBoots);
                        }
                    }
                    // Step 2 - equip new boots (rain boots!)
                    Game1.player.boots.Value = new Boots(this.rainBootsIndex);
                    Game1.player.boots.Value.onEquip();
                }
            }
        }
 public override void RemoveHat(Hat hat, bool temporary = false)
 {
     this._Hats.Remove(hat);
 }
Exemple #55
0
 public bool UpdateHat(Hat H)
 {
     _db.Hats.Update(H);
     _db.SaveChanges();
     return(true);
 }
Exemple #56
0
 internal UserPageOutgoingMessage(uint userId, string group, uint rank, bool online, ulong lastLogin, Hat hat, Color hatColor, Part head, Color headColor, Part body, Color bodyColor, Part feet, Color feetColor) : base(new JsonUserPageOutgoingMessage(userId, group, rank, online, lastLogin, hat, hatColor, head, headColor, body, bodyColor, feet, feetColor))
 {
 }
Exemple #57
0
        public static Dictionary <ISalable, int[]> getIslandMerchantTradeStock(Farmer who)
        {
            Dictionary <ISalable, int[]> tradeStock = new Dictionary <ISalable, int[]>();
            Item i = new Object(688, 1);

            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                830,
                5
            });
            i = new Object(831, 1);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                881,
                2
            });
            i = new Object(833, 1);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                851,
                1
            });
            if (Game1.netWorldState.Value.GoldenCoconutCracked.Value)
            {
                i = new Object(791, 1);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    88,
                    10
                });
            }
            i = new TV(2326, Vector2.Zero);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                830,
                30
            });
            i = new Furniture(2331, Vector2.Zero);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                848,
                5
            });
            if (Game1.dayOfMonth % 2 == 0)
            {
                i = new Furniture(134, Vector2.Zero);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    837,
                    1
                });
            }
            i = new Object(69, 1);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                852,
                5
            });
            i = new Object(835, 1);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                719,
                75
            });
            if (Game1.dayOfMonth % 7 == 1)
            {
                i = new Hat(79);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    830,
                    30
                });
            }
            if (Game1.dayOfMonth % 7 == 3)
            {
                i = new Hat(80);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    830,
                    30
                });
            }
            if (Game1.dayOfMonth % 7 == 5)
            {
                i = new Hat(81);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    830,
                    30
                });
            }
            i = new BedFurniture(2496, Vector2.Zero);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                848,
                100
            });
            i = new BedFurniture(2176, Vector2.Zero);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                829,
                20
            });
            if (Game1.dayOfMonth % 7 == 0)
            {
                i = new BedFurniture(2180, Vector2.Zero);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    91,
                    5
                });
            }
            if (Game1.dayOfMonth % 7 == 2)
            {
                i = new Furniture(2393, Vector2.Zero);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    832,
                    1
                });
            }
            if (Game1.dayOfMonth % 7 == 4)
            {
                i = new Furniture(2329, Vector2.Zero);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    834,
                    5
                });
            }
            if (Game1.dayOfMonth % 7 == 6)
            {
                i = new Furniture(1228, Vector2.Zero);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    838,
                    3
                });
            }
            i = new Object(292, 1);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                836,
                1
            });
            i = new Clothing(7);
            tradeStock.Add(i, new int[4]
            {
                0,
                2147483647,
                830,
                50
            });
            if (!Game1.player.cookingRecipes.ContainsKey("Banana Pudding"))
            {
                i = new Object(904, 1, isRecipe: true);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    1,
                    881,
                    30
                });
            }
            if (!Game1.player.cookingRecipes.ContainsKey("Deluxe Retaining Soil"))
            {
                i = new Object(920, 1, isRecipe: true);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    1,
                    848,
                    50
                });
            }
            if (Game1.dayOfMonth == 28 && Game1.stats.getStat("hardModeMonstersKilled") > 50)
            {
                i = new Object(896, 1);
                tradeStock.Add(i, new int[4]
                {
                    0,
                    2147483647,
                    910,
                    10
                });
            }
            return(tradeStock);
        }
Exemple #58
0
 private static void JoystickOnHatMoved(IJoystick arg1, Hat arg2)
 {
     Console.WriteLine("J" + arg1.Index + "> " + arg2.Index + " hat moved: " + arg2.Position);
 }
        public BaseItem GetItemByItemID(int itemID)
        {
            DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID);
            itemIdParameter.DbType = DbType.Int32;

            BaseItem b = null;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
            }

            reader.Close();
            _db.Close();

            return b;
        }
Exemple #60
0
 public void SetCurrentHat(Hat newHat)
 {
     // this must be done in main thread because it accesses UnityEngine's renderer
     HatOnCall = newHat;
     HatWaiting = true;
 }