Beispiel #1
0
        public MonsterDB(Monster monster)
        {
            Species = monster.Species;
            SecretId = monster.InstanceData.SecretId;

            Method = monster.CatchInfo.Method;
            Location = monster.CatchInfo.Location;
            TrainerName = monster.CatchInfo.TrainerName;
            TrainerId = monster.CatchInfo.TrainerId;
            PokeballId = monster.CatchInfo.PokeballId;
            Nickname = monster.CatchInfo.Nickname;

            PersonalityValue = monster.InstanceData.PersonalityValue;

            Nature = monster.Nature;

            Experience = monster.Experience;

            EggSteps = monster.EggSteps;

            IV = GetString(monster.InstanceData.IV);
            EV = GetString(monster.InstanceData.EV);
            HiddenEV = GetString(monster.InstanceData.HiddenEV);

            CurrentHP = monster.CurrentHP;
            StatusEffect = monster.StatusEffect;

            Affection = monster.Affection;
            Friendship = monster.Friendship;

            Moves = GetString(monster.Moves);

            HeldItem = monster.HeldItem;
        }
        /// <summary>
        /// Notify every <see cref="ServerModule"/> about the <see cref="Client"/> trade offer.
        /// </summary>
        public void NotifyClientTradeOffer(ServerModule caller, Client client, Monster monster, Client destClient)
        {
            OnClientTradeOffer(client, monster, destClient);

            foreach (var module in Modules.Where(module => caller != module))
                module.SendTradeRequest(client, monster, destClient, true);
        }
Beispiel #3
0
        public TradeClient(SQLiteConnection database, int playerId, Monster monster)
        {
            ClientId = playerId;

            var mon = new MonsterDB(monster);
            database.Insert(mon);
            MonsterId = mon.Id;
        }
        public static int GainExperience(IOpponentInfo trainer, Monster victorious, Monster fainted, bool hasParticipatedAndExpShare = false, bool useScaled = false)
        {
            double a = fainted.CatchInfo.TrainerId == 0 ? 1 : 1.5; // is wild
            double b = fainted.StaticData.RewardExperience;
            double e = victorious.HeldItem == 0 ? 1.5 : 0;
            double f = victorious.Affection >= 2 ? 1.2 : 1;
            double l = fainted.Level;
            double lp = victorious.Level;
            double p = 1;
            double s = hasParticipatedAndExpShare ? 2 : 1;
            double t = trainer.TrainerId == victorious.CatchInfo.TrainerId ? 1.5 : 1;
            double v = victorious.Level > victorious.StaticData.LevelEvolveRequirement ? 1.2 : 1;

            if (!useScaled)
                return (int) ((a * t * b * e * l * p * f * v) / 7 * s);
            else
                return (int) ((((a * b * l) / 5 * s) * (Math.Pow(2 * l + 10, 2.5) / Math.Pow(l + lp + 10, 2.5)) + 1) * t * e * p);
        }
Beispiel #5
0
        public override void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeOffer(this, sender, monster, destClient);

            if (destClient is P3DPlayer)
                destClient.SendPacket(new TradeOfferPacket { Origin = sender.Id, DataItems = monster.ToDataItems() });
        }
Beispiel #6
0
        public override void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false)
        {
            if (!fromServer)
                Server.NotifyClientTradeOffer(this, sender, monster, destClient);

            if (destClient is PokeDPlayer)
                destClient.SendPacket(new TradeOfferPacket { DestinationId = new VarInt(-1), MonsterData = monster.InstanceData });
        }
Beispiel #7
0
        public bool Equals(Monster value)
        {
             return value.Species.Equals(Species) &&
                   //value.CatchInfo.Equals(CatchInfo) &&
                   value.Gender.Equals(Gender) &&
                   value.Ability.Equals(Ability) &&
                   value.Nature.Equals(Nature) &&
                   value.IsShiny.Equals(IsShiny) &&
                   value.Characteristic.Equals(Characteristic) &&
                   value.Experience.Equals(Experience) &&
                   value.Level.Equals(Level) &&
                   value.EggSteps.Equals(EggSteps) &&
                   //value.EV.Equals(EV) &&
                   //value.IV.Equals(IV) &&
                   value.CurrentHP.Equals(CurrentHP) &&
                   value.StatusEffect.Equals(StatusEffect) &&
                   value.Affection.Equals(Affection) &&
                   value.Friendship.Equals(Friendship) &&
                   //value.Moves.Equals(Moves) &&
                   value.HeldItem.Equals(HeldItem);

        }
Beispiel #8
0
 public Monster(Monster maleParent, Monster femaleParent) { }
        private void OnClientTradeOffer(Client client, Monster monster, Client destClient)
        {
            if (!CurrentTrades.Any(t => t.Equals(client.Id, destClient.Id)))
                CurrentTrades.Add(new TradeInstance { Client0Id = client.Id, Client1Id = destClient.Id });

            var trade = CurrentTrades.FirstOrDefault(t => t.Equals(client.Id, destClient.Id));
            if (trade != null)
            {
                if(trade.Client0Id == client.Id)
                    trade.Client0Monster = monster;

                if (trade.Client1Id == client.Id)
                    trade.Client1Monster = monster;
            }
        }
Beispiel #10
0
 public abstract void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false);
Beispiel #11
0
 public override void SendTradeRequest(Client sender, Monster monster, Client destClient, bool fromServer = false) { }