示例#1
0
文件: Player.cs 项目: MacGiver/mooege
        public void UpdateExp(int addedExp)
        {
            GameAttributeMap attribs = new GameAttributeMap();

            this.Attributes[GameAttribute.Experience_Next] -= addedExp;

            // Levelup
            if ((this.Attributes[GameAttribute.Experience_Next] <= 0) && (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]))
            {
                this.Attributes[GameAttribute.Level]++;
                this.Properties.LevelUp();
                if (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]) { this.Attributes[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next] + LevelBorders[this.Attributes[GameAttribute.Level]]; }
                else { this.Attributes[GameAttribute.Experience_Next] = 0; }

                // Notes on attribute increment algorithm:
                // Precision: Barbarian => +1, else => +2
                // Defense:   Wizard or Demon Hunter => (lvl+1)%2+1, else => +2
                // Vitality:  Wizard or Demon Hunter => lvl%2+1, Barbarian => +2, else +1
                // Attack:    All +2
                // Attack
                this.Attributes[GameAttribute.Attack] += 2f;
                // Precision
                if (this.Properties.Class == ToonClass.Barbarian)
                {
                    this.Attributes[GameAttribute.Precision] += 1f;
                }
                else
                {
                    this.Attributes[GameAttribute.Precision] += 2f;
                }
                // Vitality and Defense
                if ((this.Properties.Class == ToonClass.Wizard) || (this.Properties.Class == ToonClass.DemonHunter))
                {
                    this.Attributes[GameAttribute.Vitality] += (this.Attributes[GameAttribute.Level] % 2) + 1f;
                    this.Attributes[GameAttribute.Defense] += ((this.Attributes[GameAttribute.Level] + 1) % 2) + 1f;
                }
                else if (this.Properties.Class == ToonClass.Barbarian)
                {
                    this.Attributes[GameAttribute.Vitality] += 2f;
                    this.Attributes[GameAttribute.Defense] += 2f;
                }
                else
                {
                    this.Attributes[GameAttribute.Vitality] += 1f;
                    this.Attributes[GameAttribute.Defense] += 2f;
                }

                attribs[GameAttribute.Level] = this.Attributes[GameAttribute.Level];
                attribs[GameAttribute.Defense] = this.Attributes[GameAttribute.Defense];
                attribs[GameAttribute.Vitality] = this.Attributes[GameAttribute.Vitality];
                attribs[GameAttribute.Precision] = this.Attributes[GameAttribute.Precision];
                attribs[GameAttribute.Attack] = this.Attributes[GameAttribute.Attack];
                attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
                attribs.SendMessage(this.InGameClient, this.DynamicID);

                this.InGameClient.SendMessage(new PlayerLevel()
                {
                    Id = 0x98,
                    Field0 = 0x00000000,
                    Field1 = this.Attributes[GameAttribute.Level],
                });

                this.InGameClient.SendMessage(new PlayEffectMessage()
                {
                    Id = 0x7a,
                    ActorID = this.DynamicID,
                    Field1 = 6,
                });
                /*this.InGameClient.SendMessage(new PlayEffectMessage()
                {
                    Id = 0x7a,
                    ActorID = this.DynamicID,
                    Field1 = 32,
                    Field2 = LevelUpEffects[this.Attributes[GameAttribute.Level]],
                });*/

                this.World.BroadcastGlobal(new PlayEffectMessage()
                {
                    Id = 0x7a,
                    ActorID = this.DynamicID,
                    Field1 = 32,
                    Field2 = LevelUpEffects[this.Attributes[GameAttribute.Level]],
                });
            }

            // constant 0 exp at Level_Cap
            if (this.Attributes[GameAttribute.Experience_Next] < 0) { this.Attributes[GameAttribute.Experience_Next] = 0; }

            attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
            attribs.SendMessage(this.InGameClient, this.DynamicID);

            //this.Attributes.SendMessage(this.InGameClient, this.DynamicID); kills the player atm
        }
示例#2
0
        public void UpdateExp(int addedExp)
        {
            GameAttributeMap attribs = new GameAttributeMap();

            this.Attributes[GameAttribute.Experience_Next] -= addedExp;

            // Levelup
            if ((this.Attributes[GameAttribute.Experience_Next] <= 0) && (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]))
            {
                this.Attributes[GameAttribute.Level]++;
                if (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]) { this.Attributes[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next] + LevelBorders[this.Attributes[GameAttribute.Level]]; }
                else { this.Attributes[GameAttribute.Experience_Next] = 0; }

                // todo: not always adding 2/2/2/1 on Levelup
                this.Attributes[GameAttribute.Defense] = 10f + (this.Attributes[GameAttribute.Level] - 1f) * 2f;
                this.Attributes[GameAttribute.Vitality] = 9f + (this.Attributes[GameAttribute.Level] - 1f) * 1f;
                this.Attributes[GameAttribute.Precision] = 11f + (this.Attributes[GameAttribute.Level] - 1f) * 2f;
                this.Attributes[GameAttribute.Attack] = 10f + (this.Attributes[GameAttribute.Level] - 1f) * 2f;
                attribs[GameAttribute.Level] = this.Attributes[GameAttribute.Level];
                attribs[GameAttribute.Defense] = this.Attributes[GameAttribute.Defense];
                attribs[GameAttribute.Vitality] = this.Attributes[GameAttribute.Vitality];
                attribs[GameAttribute.Precision] = this.Attributes[GameAttribute.Precision];
                attribs[GameAttribute.Attack] = this.Attributes[GameAttribute.Attack];
                attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
                attribs.SendMessage(this.InGameClient, this.DynamicID);

                this.InGameClient.SendMessage(new PlayerLevel()
                {
                    Id = 0x98,
                    Field0 = 0x00000000,
                    Field1 = this.Attributes[GameAttribute.Level],
                });

                this.InGameClient.SendMessage(new PlayEffectMessage()
                {
                    Id = 0x7a,
                    ActorID = this.DynamicID,
                    Field1 = 6,
                });
                this.InGameClient.SendMessage(new PlayEffectMessage()
                {
                    Id = 0x7a,
                    ActorID = this.DynamicID,
                    Field1 = 32,
                    Field2 = LevelUpEffects[this.Attributes[GameAttribute.Level]],
                });
            }

            // constant 0 exp at Level_Cap
            if (this.Attributes[GameAttribute.Experience_Next] < 0) { this.Attributes[GameAttribute.Experience_Next] = 0; }

            attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
            attribs.SendMessage(this.InGameClient, this.DynamicID);

            //this.Attributes.SendMessage(this.InGameClient, this.DynamicID); kills the player atm
        }
示例#3
0
文件: Player.cs 项目: MacGiver/mooege
        // FIXME: Hardcoded crap
        public override void OnEnter(World world)
        {
            this.World.Reveal(this);

            // FIXME: hackedy hack
            var attribs = new GameAttributeMap();
            attribs[GameAttribute.Hitpoints_Healed_Target] = 76f;
            attribs.SendMessage(InGameClient, this.DynamicID);
        }
示例#4
0
        // FIXME: Hardcoded crap
        public override void OnEnter(World world)
        {
            this.World.Reveal(this);

            // This "tick" stuff is somehow required to use these values.. /komiga
            this.InGameClient.SendMessage(new DWordDataMessage() // TICK
            {
                Id = 0x0089,
                Field0 = 0x00000077,
            });
            this.InGameClient.FlushOutgoingBuffer();

            // FIXME: hackedy hack
            var attribs = new GameAttributeMap();
            attribs[GameAttribute.Hitpoints_Healed_Target] = 76f;
            attribs.SendMessage(InGameClient, this.DynamicID);

            this.InGameClient.PacketId += 40 * 2;
            this.InGameClient.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = 0x0000007D //this.InGameClient.PacketId,
            });
            this.InGameClient.FlushOutgoingBuffer();
        }
示例#5
0
        public void Handle(GameClient client)
        {
            var player = client.Player;
            switch (this.Id)
            {
                case 0x0030: // Sent with DwordDataMessage(0x0125, Value:0) and SimpleMessage(0x0125)
                    {
                        // What the dickens is this stuff
                        #region hardcoded1
                        #region Player Attribute Values

                        GameAttributeMap attributes = new GameAttributeMap();
                        attributes[GameAttribute.Banter_Cooldown, 0xFFFFF] = 0x000007C9;
                        attributes[GameAttribute.Buff_Active, 0x20CBE] = true;
                        attributes[GameAttribute.Buff_Active, 0x33C40] = false;
                        attributes[GameAttribute.Immobolize] = false;
                        attributes[GameAttribute.Untargetable] = false;
                        attributes[GameAttribute.CantStartDisplayedPowers] = false;
                        attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x20CBE] = 0xC1;
                        attributes[GameAttribute.Disabled] = false;
                        attributes[GameAttribute.Hidden] = false;
                        attributes[GameAttribute.Buff_Icon_Count0, 0x33C40] = 0;
                        attributes[GameAttribute.Buff_Icon_End_Tick0, 0x20CBE] = 0x7C9;
                        attributes[GameAttribute.Loading] = false;
                        attributes[GameAttribute.Buff_Icon_End_Tick0, 0x33C40] = 0;
                        attributes[GameAttribute.Invulnerable] = false;
                        attributes[GameAttribute.Buff_Icon_Count0, 0x20CBE] = 1;
                        attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x33C40] = 0;
                        attributes.SendMessage(client, player.DynamicID);

                        #endregion

                        client.SendMessage(new ACDCollFlagsMessage()
                        {
                            ActorID = player.DynamicID,
                            CollFlags = 0x00000008,
                        });

                        client.SendMessage(new DWordDataMessage()
                        {
                            Id = 0x0089,
                            Field0 = 0x000000C1,
                        });
                        #endregion
                        
                        #region hardcoded2
                        // NOTE: This is very similar to ACDEnterKnown fields
                        // TODO: Map proper values from the actor..
                        client.SendMessage(new TrickleMessage()
                        {
                            ActorId = player.DynamicID,
                            ActorSNO = client.Player.ClassSNO,
                            WorldLocation = new WorldPlace()
                            {
                                Position = new Vector3D()
                                {
                                    X = 3143.75f,
                                    Y = 2828.75f,
                                    Z = 59.07559f,
                                },
                                WorldID = client.Player.World.DynamicID,
                            },
                            PlayerIndex = 0x00000000,
                            LevelAreaSNO = 0x00026186,
                            Field5 = 1f,
                            Field6 = 0x00000001,
                            Field7 = 0x00000024,
                            Field10 = unchecked((int)0x8DFA5D13),
                            StringListSNO = 0x0000F063,
                        });

                        client.SendMessage(new DWordDataMessage()
                        {
                            Id = 0x0089,
                            Field0 = 0x000000D1,
                        });
                        #endregion
                        
                    }
                    break;
                case 0x0028: // Logout complete (sent when delay timer expires on client side)
                    //if (client.IsLoggingOut)
                    //{
                    //    client.SendMessageNow(new QuitGameMessage()
                    //    {
                    //        Id = 0x0003,
                    //        // Field0 - quit reason?
                    //        // 0 - logout
                    //        // 1 - kicked by party leader
                    //        // 2 - disconnected due to client-server (version?) missmatch
                    //        PlayerIndex = 0,
                    //    });
                    //}
                    break;
                default:
                    throw new NotImplementedException();
            }
        }
示例#6
0
文件: Player.cs 项目: Sanchen/mooege
        // FIXME: Hardcoded crap
        // FIXME: The new player stuff only needs to be called when the player joins the game
        public override void OnEnter(World world)
        {
            this.World.Reveal(this);

            // Notify the client of the new player
            InGameClient.SendMessage(new NewPlayerMessage
            {
                Field0 = 0x00000000, //Party frame (0x00000000 hide, 0x00000001 show)
                Field1 = "", //Owner name?
                ToonName = this.Properties.Name,
                Field3 = 0x00000002, //party frame class
                Field4 = 0x00000004, //party frame level
                snoActorPortrait = this.ClassSNO, //party frame portrait
                Field6 = 0x00000001,
                StateData = this.GetStateData(),
                Field8 = false, //announce party join
                Field9 = 0x00000001,
                ActorID = this.DynamicID,
            });

            InGameClient.SendMessage(new ACDCollFlagsMessage
            {
                ActorID = this.DynamicID,
                CollFlags = 0x00000000,
            });

            this.Attributes.SendMessage(InGameClient, this.DynamicID);

            // TODO: Pretty sure most of this stuff can be (and probably should be) put into Actor.Reveal()
            this.InGameClient.SendMessage(new ACDGroupMessage()
            {
                ActorID = this.DynamicID,
                Field1 = -1,
                Field2 = -1,
            });

            this.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage7)
            {
                ActorID = this.DynamicID,
            });

            this.InGameClient.SendMessage(new ACDTranslateFacingMessage(Opcodes.ACDTranslateFacingMessage1)
            {
                ActorID = this.DynamicID,
                Angle = 3.022712f,
                Field2 = false,
            });

            this.InGameClient.SendMessage(new PlayerEnterKnownMessage()
            {
                Field0 = 0x00000000,
                PlayerID = this.DynamicID,
            });

            this.InGameClient.SendMessage(new PlayerActorSetInitialMessage()
            {
                PlayerID = this.DynamicID,
                Field1 = 0x00000000,
            });

            this.InGameClient.SendMessage(new SNONameDataMessage()
            {
                Name = new SNOName()
                {
                    Group = 0x00000001,
                    Handle = this.ClassSNO,
                },
            });
            this.InGameClient.FlushOutgoingBuffer();

            this.InGameClient.SendMessage(new PlayerWarpedMessage()
            {
                Field0 = 9,
                Field1 = 0f,
            });

            // This "tick" stuff is somehow required to use these values.. /komiga
            this.InGameClient.SendMessage(new DWordDataMessage() // TICK
            {
                Id = 0x0089,
                Field0 = 0x00000077,
            });
            this.InGameClient.FlushOutgoingBuffer();

            // FIXME: hackedy hack
            var attribs = new GameAttributeMap();
            attribs[GameAttribute.Hitpoints_Healed_Target] = 76f;
            attribs.SendMessage(InGameClient, this.DynamicID);

            this.InGameClient.PacketId += 40 * 2;
            this.InGameClient.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = 0x0000007D //this.InGameClient.PacketId,
            });
            this.InGameClient.FlushOutgoingBuffer();
        }
示例#7
0
文件: Player.cs 项目: keltins/mooege
        public void UpdateExp(int addedExp)
        {
            GameAttributeMap attribs = new GameAttributeMap();

            this.Attributes[GameAttribute.Experience_Next] -= addedExp;

            // Levelup
            if ((this.Attributes[GameAttribute.Experience_Next] <= 0) && (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]))
            {
                this.Attributes[GameAttribute.Level]++;
                this.Properties.LevelUp();
                if (this.Attributes[GameAttribute.Level] < this.Attributes[GameAttribute.Level_Cap]) { this.Attributes[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next] + LevelBorders[this.Attributes[GameAttribute.Level]]; }
                else { this.Attributes[GameAttribute.Experience_Next] = 0; }

                // 4 main attributes are incremented according to class
                this.Attributes[GameAttribute.Attack] += this.AttackIncrement;
                this.Attributes[GameAttribute.Precision] += this.PrecisionIncrement;
                this.Attributes[GameAttribute.Vitality] += this.VitalityIncrement;
                this.Attributes[GameAttribute.Defense] += this.DefenseIncrement;

                // Hitpoints from level may actually change. This needs to be verified by someone with the beta.
                //this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = this.Attributes[GameAttribute.Level] * this.Attributes[GameAttribute.Hitpoints_Factor_Level];
                
                // For now, hit points are based solely on vitality and initial hitpoints received.
                // This will have to change when hitpoint bonuses from items are implemented.
                this.Attributes[GameAttribute.Hitpoints_Total_From_Vitality] = this.Attributes[GameAttribute.Vitality] * this.Attributes[GameAttribute.Hitpoints_Factor_Vitality];
                this.Attributes[GameAttribute.Hitpoints_Max] = GetMaxTotalHitpoints();
                this.Attributes[GameAttribute.Hitpoints_Max_Total] = GetMaxTotalHitpoints();

                // On level up, health is set to max
                this.Attributes[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Max_Total];

                attribs[GameAttribute.Level] = this.Attributes[GameAttribute.Level];
                attribs[GameAttribute.Defense] = this.Attributes[GameAttribute.Defense];
                attribs[GameAttribute.Vitality] = this.Attributes[GameAttribute.Vitality];
                attribs[GameAttribute.Precision] = this.Attributes[GameAttribute.Precision];
                attribs[GameAttribute.Attack] = this.Attributes[GameAttribute.Attack];
                attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
                attribs[GameAttribute.Hitpoints_Total_From_Vitality] = this.Attributes[GameAttribute.Hitpoints_Total_From_Vitality];
                attribs[GameAttribute.Hitpoints_Max_Total] = this.Attributes[GameAttribute.Hitpoints_Max_Total];
                attribs[GameAttribute.Hitpoints_Max] = this.Attributes[GameAttribute.Hitpoints_Max];
                attribs[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Cur];

                attribs.SendMessage(this.InGameClient, this.DynamicID);

                this.InGameClient.SendMessage(new PlayerLevel()
                {
                    Id = 0x98,
                    Field0 = 0x00000000,
                    Field1 = this.Attributes[GameAttribute.Level],
                });

                this.InGameClient.SendMessage(new PlayEffectMessage()
                {
                    ActorId = this.DynamicID,
                    Effect = Effect.LevelUp,
                });

                this.World.BroadcastGlobal(new PlayEffectMessage()
                {
                    ActorId = this.DynamicID,
                    Effect = Effect.PlayEffectGroup,
                    OptionalParameter = LevelUpEffects[this.Attributes[GameAttribute.Level]],
                });
            }

            // constant 0 exp at Level_Cap
            if (this.Attributes[GameAttribute.Experience_Next] < 0) { this.Attributes[GameAttribute.Experience_Next] = 0; }

            attribs[GameAttribute.Experience_Next] = this.Attributes[GameAttribute.Experience_Next];
            attribs.SendMessage(this.InGameClient, this.DynamicID);

            //this.Attributes.SendMessage(this.InGameClient, this.DynamicID); kills the player atm
        }
示例#8
0
文件: Player.cs 项目: rosebud/mooege
 // simple static reresh 
 public void RefreshStatistic()
 {
     var attribs = new GameAttributeMap();
     // min demage
     this.Attributes[GameAttribute.Damage_Weapon_Min_Total_CurrentHand, 0] = this.Attributes[GameAttribute.Damage_Weapon_Min_Total_MainHand, 0];// only main hand "(DualWield_Hand#NONE ? Damage_Weapon_Min_Total_OffHand : Damage_Weapon_Min_Total_MainHand)"
     this.Attributes[GameAttribute.Damage_Min_Subtotal, 0] = this.Attributes[GameAttribute.Damage_Min, 0] + this.Attributes[GameAttribute.Damage_Bonus_Min, 0] + this.Attributes[GameAttribute.Damage_Weapon_Min_Total_CurrentHand, 0];
     this.Attributes[GameAttribute.Damage_Min_Total, 0] = this.Attributes[GameAttribute.Damage_Min_Subtotal, 0] + this.Attributes[GameAttribute.Damage_Type_Percent_Bonus, 0] * this.Attributes[GameAttribute.Damage_Min_Subtotal, 0];
     // delta demage
     this.Attributes[GameAttribute.Damage_Weapon_Delta_Total_CurrentHand, 0] = this.Attributes[GameAttribute.Damage_Weapon_Delta_Total_MainHand, 0];// only main hand "(DualWield_Hand#NONE ? Damage_Weapon_Min_Total_OffHand : Damage_Weapon_Min_Total_MainHand)"
     this.Attributes[GameAttribute.Damage_Delta_Total, 0] = Math.Max(this.Attributes[GameAttribute.Damage_Delta, 0] - this.Attributes[GameAttribute.Damage_Bonus_Min, 0] + this.Attributes[GameAttribute.Damage_Weapon_Delta_Total_CurrentHand, 0], 0);
     // attack speed hack
     this.Attributes[GameAttribute.Attacks_Per_Second_Item_CurrentHand] = this.Attributes[GameAttribute.Attacks_Per_Second_Item_MainHand]; 
     this.Attributes[GameAttribute.Attacks_Per_Second_Total] = this.Attributes[GameAttribute.Attacks_Per_Second_Item_CurrentHand];     
                   
     attribs[GameAttribute.Damage_Min_Total, 0] = this.Attributes[GameAttribute.Damage_Min_Total, 0];
     attribs[GameAttribute.Damage_Delta_Total, 0] = this.Attributes[GameAttribute.Damage_Delta_Total, 0];
     attribs[GameAttribute.Attacks_Per_Second_Total] = this.Attributes[GameAttribute.Attacks_Per_Second_Total];
     attribs.SendMessage(InGameClient, DynamicID);
 }