Esempio n. 1
0
        public List <MapleCharacter> GetPartyMembers(MapleParty party)
        {
            var partym = new List <MapleCharacter>();

            party.GetMembers().ForEach(partychar =>
            {
                if (partychar.ChannelId == ChannelId)
                {
                    // Make sure the thing doesn't get duplicate plays due to ccing bug.
                    var chr = Characters.FirstOrDefault(x => x.Name == partychar.CharacterName);
                    if (chr != null)
                    {
                        partym.Add(chr);
                    }
                }
            });
            return(partym);
        }
Esempio n. 2
0
            public void KilledMob(MapleMap map, int baseExp, bool mostDamage)
            {
                Dictionary <MapleCharacter, OnePartyAttacker> attackers = ResolveAttackers();

                MapleCharacter highest       = null;
                int            highestDamage = 0;

                Dictionary <MapleCharacter, int> expMap = new Dictionary <MapleCharacter, int>(6);

                foreach (var attacker in attackers)
                {
                    MapleParty party             = attacker.Value.LastKnownParty;
                    double     averagePartyLevel = 0;

                    List <MapleCharacter> expApplicable = new List <MapleCharacter>();
                    foreach (var partychar in party.GetMembers())
                    {
                        if (attacker.Key.Level - partychar.Level <= 5 || m_monster.Stats.Level - partychar.Level <= 5)
                        {
                            MapleCharacter pchr = m_cserv.Characters.FirstOrDefault(x => x.Name == partychar.CharacterName);
                            if (pchr == null)
                            {
                                continue;
                            }
                            if (!pchr.IsAlive || pchr.Map != map)
                            {
                                continue;
                            }
                            expApplicable.Add(pchr);
                            averagePartyLevel += pchr.Level;
                        }
                    }
                    double expBonus = 1.0;
                    if (expApplicable.Count > 1)
                    {
                        expBonus           = 1.10 + 0.05 * expApplicable.Count;
                        averagePartyLevel /= expApplicable.Count;
                    }

                    int iDamage = attacker.Value.Damage;
                    if (iDamage > highestDamage)
                    {
                        highest       = attacker.Key;
                        highestDamage = iDamage;
                    }
                    double innerBaseExp = baseExp * ((double)iDamage / m_totDamage);
                    double expFraction  = innerBaseExp * expBonus / (expApplicable.Count + 1);

                    foreach (var expReceiver in expApplicable)
                    {
                        int    oexp;
                        int    iexp      = !expMap.TryGetValue(expReceiver, out oexp) ? 0 : oexp;
                        double expWeight = expReceiver == attacker.Key ? 2.0 : 1.0;
                        double levelMod  = expReceiver.Level / averagePartyLevel;
                        if (levelMod > 1.0 || m_attackers.ContainsKey(expReceiver.Id))
                        {
                            levelMod = 1.0;
                        }
                        iexp += (int)Math.Round(expFraction * expWeight * levelMod);
                        if (expMap.ContainsKey(expReceiver))
                        {
                            expMap[expReceiver] = iexp;
                        }
                        else
                        {
                            expMap.Add(expReceiver, iexp);
                        }
                    }
                }
                // F**K we are done -.-
                foreach (var expReceiver in expMap)
                {
                    bool white = mostDamage && expReceiver.Key == highest;
                    m_monster.GiveExpToCharacter(expReceiver.Key, expReceiver.Value, white, expMap.Count);
                }
            }