Beispiel #1
0
 private void OnModMessageReceived(object sender, ModMessageReceivedEventArgs e)
 {
     if (e.Type == PlayerWarpedHomeMessageId && Context.IsMainPlayer && e.FromModID == SModManifest.UniqueID)
     {
         PlayerWarpedMessage message = e.ReadAs <PlayerWarpedMessage>();
         HandleTeleportingPetsHomeAtNight(Game1.getFarmer(message.playerId));
         return;
     }
 }
Beispiel #2
0
        private void DoPlayerDeath()
        {
            this.Target.PlayEffect(Net.GS.Message.Definitions.Effect.Effect.Unknown38);
            //not sure why count does not appear
            this.Target.Attributes[GameAttribute.Death_Count] += 1;


            //TODO: there seems to be a special trade message on death, maybe blocking trades with user...
            //TradeMessage:
            //{
            // Field0: 0x00000001 (1)
            // Field1: 0x789F005A (2023686234) ActorId
            // Field2: 0x44070500 (1141310720)
            // Field3: 0x00002AAB98C93000   First8: WorldId this.Target.World.DynamicID;
            // Field4: 0x98C93328 (-1731644632)
            // Field5:
            // {
            //  0x00002AAB, 0x44070530, 0x00000000, 0x44070500, 0x00000000,
            // }

            //}

            //TradeMessage:
            //{
            // Field0: 0x00000001 (1)
            // Field1: 0x78AF004F (2024734799) ActorId
            // Field2: 0x45E73500 (1172780288)
            // Field3: 0x00002AABBB4BC000
            // Field4: 0xBB4BC490 (-1152662384)
            // Field5:
            // {
            //  0x00002AAB, 0x45E73530, 0x00000000, 0x45E73500, 0x00000000,
            // }

            //}


            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00020C51]   = 0;
            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00020CBE]   = 0;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00020CBE]      = 0;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00020CBE]           = false;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00020CBE] = 0;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00020C51] = 0;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00020C51]      = 0;
            this.Target.Attributes[GameAttribute.Banter_Cooldown, 0x000FFFFF]       = -1;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00020C51]           = false;

            this.Target.World.BroadcastIfRevealed(new ANNDataMessage(Opcodes.ANNDataMessage13)
            {
                ActorID = this.Target.DynamicID
            }, this.Target);

            this.Target.Attributes[GameAttribute.Look_Override] = 0x0782CAC5;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x0002F39E]      = 1;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x0002F39E]           = true;
            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00033C40]   = 0x00001733;
            this.Target.Attributes[GameAttribute.Resource_Cur, 0x00000003]          = 150;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00036D7F] = 0x000013AF;
            this.Target.Attributes[GameAttribute.Immobolize]   = true;
            this.Target.Attributes[GameAttribute.Untargetable] = true;
            this.Target.Attributes[GameAttribute.Stealthed]    = true;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00036D7F] = 1;
            this.Target.Attributes[GameAttribute.Hitpoints_Cur]                   = 120;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00036D7F]         = true;
            this.Target.Attributes[GameAttribute.Attacks_Per_Second_Percent]      = 0.1499023F;
            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00036D7F] = 0x0000100B;
            this.Target.Attributes[GameAttribute.Attacks_Per_Second_Total]        = 1.379883F;
            this.Target.Attributes[GameAttribute.Hidden]               = true;
            this.Target.Attributes[GameAttribute.Loading]              = true;
            this.Target.Attributes[GameAttribute.Invulnerable]         = true;
            this.Target.Attributes[GameAttribute.Projectile_Speed]     = 3.051758E-05F; //probably min speed
            this.Target.Attributes[GameAttribute.Headstone_Player_ANN] = -1;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00020C51]           = 0x00000905;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x0000CE11]                = 1;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00033C40]           = 0x00000F57; //different value
            this.Target.Attributes[GameAttribute.Buff_Active, 0x0000CE11]                     = true;
            this.Target.Attributes[GameAttribute.Power_Buff_0_Visual_Effect_None, 0x00036D7F] = true;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00020C51]                = 1;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00033C40]                     = true;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00033C40]                = 1;
            this.Target.Attributes[GameAttribute.CantStartDisplayedPowers]                    = true;
            this.Target.PlayEffect(Net.GS.Message.Definitions.Effect.Effect.Unknown22);
            this.Target.Attributes.BroadcastChangedIfRevealed();
            this.Target.World.BuffManager.RemoveAllBuffs(this.Target);
            this.Target.World.PowerManager.CancelAllPowers(this.Target);
            //TODO: There should be a 1-2 sec wait timer here so client shows the nice effect

            //move user to new position
            //TODO: Find last waypoint
            var lastWaypoint = new Common.Types.Math.Vector3D();

            lastWaypoint = this.Target.CheckPointPosition;

            /*lastWaypoint.X = 3143.75F;
             * lastWaypoint.Y = 2828.75F;
             * lastWaypoint.Z = 59.17559F;*/
            var deathWorld = new ACDWorldPositionMessage();

            deathWorld.ActorID                                       = this.Target.DynamicID;
            deathWorld.WorldLocation                                 = new WorldLocationMessageData();
            deathWorld.WorldLocation.Scale                           = 1.43F;
            deathWorld.WorldLocation.Transform                       = new Common.Types.Math.PRTransform();
            deathWorld.WorldLocation.Transform.Quaternion            = new Common.Types.Math.Quaternion();
            deathWorld.WorldLocation.Transform.Quaternion.W          = 0.05940545F;
            deathWorld.WorldLocation.Transform.Quaternion.Vector3D   = new Common.Types.Math.Vector3D();
            deathWorld.WorldLocation.Transform.Quaternion.Vector3D.X = 0;
            deathWorld.WorldLocation.Transform.Quaternion.Vector3D.Y = 0;
            deathWorld.WorldLocation.Transform.Quaternion.Vector3D.Z = 0.9982339F;
            deathWorld.WorldLocation.Transform.Vector3D              = lastWaypoint;
            deathWorld.WorldLocation.WorldID                         = this.Target.World.DynamicID;
            this.Target.World.BroadcastIfRevealed(deathWorld, this.Target);

            var snappedMessage = new ACDTranslateSnappedMessage();

            snappedMessage.Field0 = (int)this.Target.DynamicID;
            snappedMessage.Field1 = lastWaypoint;
            snappedMessage.Field2 = 3.022712F;
            snappedMessage.Field3 = true;
            snappedMessage.Field4 = 0x00000900; //constant in death
            this.Target.World.BroadcastIfRevealed(snappedMessage, this.Target);

            var playerWarpedMessage = new PlayerWarpedMessage();

            playerWarpedMessage.Field0 = 0x00000000; //sometimes 5
            playerWarpedMessage.Field1 = 0;

            this.Target.Attributes[GameAttribute.Buff_Visual_Effect, 0x000FFFFF] = true;
            // No need to reset our max hp that i can think of - DarkLotus
            //this.Target.Attributes[GameAttribute.Hitpoints_Max_Total] = 80; //Orig = 1;
            //this.Target.Attributes[GameAttribute.Hitpoints_Max] = 80;  //Orig = 0.0009994507F;
            this.Target.Attributes[GameAttribute.Hitpoints_Healed_Target] = this.Target.Attributes[GameAttribute.Hitpoints_Max_Total]; //heal up -should be w/e needs to be
            ((Player)this.Target).AddPercentageHP(100);
            //start reverting buffs
            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00033C40] = 0;
            this.Target.Attributes[GameAttribute.Immobolize] = false;
            this.Target.Attributes[GameAttribute.Hidden]     = false;
            this.Target.Attributes[GameAttribute.Loading]    = false;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00033C40] = 0;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00033C40]           = false;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00033C40]      = 0;
            this.Target.Attributes[GameAttribute.Look_Override] = 0;
            this.Target.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00036D7F] = 0;
            this.Target.Attributes[GameAttribute.Untargetable] = false;
            this.Target.Attributes[GameAttribute.Stealthed]    = false;
            this.Target.Attributes[GameAttribute.Buff_Icon_Count0, 0x00036D7F]    = 0;
            this.Target.Attributes[GameAttribute.Buff_Active, 0x00036D7F]         = false;
            this.Target.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00036D7F] = 0;
            this.Target.Attributes[GameAttribute.Invulnerable] = false;
            this.Target.Attributes[GameAttribute.Power_Buff_0_Visual_Effect_None, 0x00036D7F] = false;
            this.Target.Attributes[GameAttribute.CantStartDisplayedPowers] = false;
            this.Target.Attributes.BroadcastChangedIfRevealed();
            // Update player.Position otherwise server treats you as your at old loc till you take a step - DarkLotus
            this.Target.Position = lastWaypoint;
            return;
        }