Beispiel #1
0
        public RebornEnum Reborn()
        {
            if (this.CurrentAccount == null || this.CurrentAccount.ActiveCharacter == null)
            {
                return(RebornEnum.Error);
            }
            if (this.CurrentAccount.ActiveCharacter.IsAsda2BattlegroundInProgress)
            {
                return(RebornEnum.YouMustLeaveWar);
            }
            if (this.CurrentAccount.ActiveCharacter.Level < CharacterFormulas.RebornLevel)
            {
                return(RebornEnum.YouMustReachAtLeast80Level);
            }
            foreach (Asda2Item asda2Item in this.CurrentAccount.ActiveCharacter.Asda2Inventory.Equipment)
            {
                if (asda2Item != null)
                {
                    return(RebornEnum.YouMustPutOffCloses);
                }
            }

            if (this.CurrentAccount.ActiveCharacter.IsReborning)
            {
                return(RebornEnum.Error);
            }
            this.CurrentAccount.ActiveCharacter.IsReborning = true;
            this.CurrentAccount.ActiveCharacter.AddMessage((Action)(() =>
            {
                ++this.CurrentAccount.ActiveCharacter.Record.RebornCount;
                FunctionalItemsHandler.ResetSkills(this.CurrentAccount.ActiveCharacter);
                this.CurrentAccount.ActiveCharacter.SetClass((int)this.CurrentAccount.ActiveCharacter.RealProffLevel,
                                                             (int)this.CurrentAccount.ActiveCharacter.Archetype.ClassId);
                ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
                {
                    foreach (CharacterFormulas.ItemIdAmounted itemIdAmounted in CharacterFormulas.ItemIdsToAddOnReborn)
                    {
                        this.CurrentAccount.ActiveCharacter.Asda2Inventory.AddDonateItem(
                            Asda2ItemMgr.GetTemplate(itemIdAmounted.ItemId), itemIdAmounted.Amount, "reborn_system",
                            false);
                    }
                }));
                Log.Create(Log.Types.StatsOperations, LogSourceType.Character,
                           this.CurrentAccount.ActiveCharacter.EntryId).AddAttribute("source", 0.0, "reborn")
                .AddAttribute("count", (double)this.CurrentAccount.ActiveCharacter.Record.RebornCount, "").Write();
                this.CurrentAccount.ActiveCharacter.Level = 1;
                this.CurrentAccount.ActiveCharacter.ResetStatPoints();
                this.CurrentAccount.ActiveCharacter.SendInfoMsg(
                    string.Format("Congratulations on the new reincarnation!"));
                this.CurrentAccount.ActiveCharacter.IsReborning = false;
            }));
            return(RebornEnum.Ok);
        }
Beispiel #2
0
        public RebornEnum Reborn()
        {
            //if (CurrentAccount == null || CurrentAccount.ActiveCharacter == null)
            return(RebornEnum.Error);

            if (CurrentAccount.ActiveCharacter.IsAsda2BattlegroundInProgress)
            {
                return(RebornEnum.YouMustLeaveWar);
            }
            if (CurrentAccount.ActiveCharacter.Level < CharacterFormulas.RebornLevel)
            {
                return(RebornEnum.YouMustReachAtLeast80Level);
            }
            foreach (var asda2Item in CurrentAccount.ActiveCharacter.Asda2Inventory.Equipment)
            {
                if (asda2Item != null)
                {
                    return(RebornEnum.YouMustPutOffCloses);
                }
            }
            if (CurrentAccount.ActiveCharacter.IsReborning)
            {
                return(RebornEnum.Error);
            }
            CurrentAccount.ActiveCharacter.IsReborning = true;
            CurrentAccount.ActiveCharacter.AddMessage(() =>
            {
                CurrentAccount.ActiveCharacter.Record.RebornCount++;
                FunctionalItemsHandler.ResetSkills(CurrentAccount.ActiveCharacter);
                CurrentAccount.ActiveCharacter.SetClass(CurrentAccount.ActiveCharacter.RealProffLevel, (int)CurrentAccount.ActiveCharacter.Archetype.ClassId);
                RealmServer.IOQueue.AddMessage(() =>
                {
                    foreach (var itemIdAmounted in CharacterFormulas.ItemIdsToAddOnReborn)
                    {
                        CurrentAccount.ActiveCharacter.Asda2Inventory.AddDonateItem(
                            Asda2ItemMgr.GetTemplate(itemIdAmounted.ItemId), itemIdAmounted.Amount, "reborn_system");
                    }
                });
                Log.Create(Log.Types.StatsOperations, LogSourceType.Character, CurrentAccount.ActiveCharacter.EntryId)
                .AddAttribute("source", 0, "reborn")
                .AddAttribute("count", CurrentAccount.ActiveCharacter.Record.RebornCount)
                .Write();

                CurrentAccount.ActiveCharacter.Level = 49;
                CurrentAccount.ActiveCharacter.ResetStatPoints();
                CurrentAccount.ActiveCharacter.SendInfoMsg(string.Format("ѕоздравл¤ем с новым перерождением!"));
                CurrentAccount.ActiveCharacter.IsReborning = false;
            });
            return(RebornEnum.Ok);
        }
Beispiel #3
0
        public ResetStatsEnum ResetSkills()
        {
            //if (CurrentAccount == null || CurrentAccount.ActiveCharacter == null)
            return(ResetStatsEnum.Error);

            var goldToReset = CurrentAccount.ActiveCharacter.Level < 30 ? 0 : CurrentAccount.ActiveCharacter.Level * 10000;

            if (!CurrentAccount.ActiveCharacter.SubtractMoney((uint)goldToReset))
            {
                return(ResetStatsEnum.NotEnoughtMoney);
            }
            FunctionalItemsHandler.ResetSkills(CurrentAccount.ActiveCharacter);
            CurrentAccount.ActiveCharacter.SendMoneyUpdate();
            return(ResetStatsEnum.Ok);
        }
Beispiel #4
0
 public ResetStatsEnum ResetSkills()
 {
     if (this.CurrentAccount == null || this.CurrentAccount.ActiveCharacter == null)
     {
         return(ResetStatsEnum.Error);
     }
     if (!this.CurrentAccount.ActiveCharacter.SubtractMoney(this.CurrentAccount.ActiveCharacter.Level < 30
         ? 0U
         : (uint)(this.CurrentAccount.ActiveCharacter.Level * 10000)))
     {
         return(ResetStatsEnum.NotEnoughtMoney);
     }
     FunctionalItemsHandler.ResetSkills(this.CurrentAccount.ActiveCharacter);
     this.CurrentAccount.ActiveCharacter.SendMoneyUpdate();
     return(ResetStatsEnum.Ok);
 }