Beispiel #1
0
        public void CheckTokKills(ushort type, uint count)
        {
            Tok_Bestary TB = TokService.GetTokBestary(type);

            if (TB == null)
            {
                return;
            }

            uint kill = count;

            string tok;

            if (kill >= 1 && TB.Kill1 != null)
            {
                tok = TB.Kill1;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }

            if (kill >= 25 && TB.Kill25 != null)
            {
                tok = TB.Kill25;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }

            if (kill >= 100 && TB.Kill100 != null)
            {
                tok = TB.Kill100;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }

            if (kill >= 1000 && TB.Kill1000 != null)
            {
                tok = TB.Kill1000;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }

            if (kill >= 10000 && TB.Kill10000 != null)
            {
                tok = TB.Kill10000;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }

            if (kill >= 100000 && TB.Kill100000 != null)
            {
                tok = TB.Kill100000;
                string[] tmp = tok.Split(';');
                if (tmp.Length > 0)
                {
                    foreach (string st in tmp)
                    {
                        FixTokKills(UInt16.Parse(st));
                    }
                }
                else
                {
                    FixTokKills(UInt16.Parse(tok));
                }
            }
        }
Beispiel #2
0
        public void AddKill(ushort type)
        {
            Tok_Bestary TB = TokService.GetTokBestary(type);

            if (TB == null)
            {
                return;
            }

            Character_tok_kills kills;

            if (_tokKillCount.TryGetValue(TB.Bestary_ID, out kills))
            {
                kills.Count++;
                kills.Dirty = true;
                CharMgr.Database.SaveObject(kills);
            }

            else
            {
                kills = new Character_tok_kills
                {
                    NPCEntry    = TB.Bestary_ID,
                    CharacterId = GetPlayer().CharacterId,
                    Count       = 1
                };
                _tokKillCount.Add(TB.Bestary_ID, kills);
                GetPlayer().Info.TokKills = _tokKillCount.Values.ToList();
                CharMgr.Database.AddObject(kills);
            }
            uint kill = kills.Count;

            //Log.Info("creature type", "" + type+"  bestid "+ TB.Bestary_ID + " kills "+ kill);

            SendActionCounterUpdate(TB.Bestary_ID, kill);

            // total kill counter

            if (_tokKillCount.TryGetValue(495, out kills))
            {
                kills.Count++;
                kills.Dirty = true;
                CharMgr.Database.SaveObject(kills);
            }
            SendActionCounterUpdate(495, kills.Count);

            string tok;

            if (kill == 100000 && TB.Kill100000 != null)
            {
                tok = TB.Kill100000;
            }
            else if (kill == 10000 && TB.Kill10000 != null)
            {
                tok = TB.Kill10000;
            }
            else if (kill == 1000 && TB.Kill1000 != null)
            {
                tok = TB.Kill1000;
            }
            else if (kill == 100 && TB.Kill100 != null)
            {
                tok = TB.Kill100;
            }
            else if (kill == 25 && TB.Kill25 != null)
            {
                tok = TB.Kill25;
            }
            else if (kill == 1 && TB.Kill1 != null)
            {
                tok = TB.Kill1;
            }
            else
            {
                return;
            }

            string[] tmp = tok.Split(';');
            if (tmp.Length > 0)
            {
                foreach (string st in tmp)
                {
                    AddTok(UInt16.Parse(st));
                }
            }
            else
            {
                AddTok(UInt16.Parse(tok));
            }
        }