Пример #1
0
        public void OnHomePoint()
        {
            if (this.Char.stance != Global.STANCE.DIE || this.Char.HP != 0)
            {
                return;
            }
            if (this.Char.save_map == 0)
            {
                this.Char.save_map = 3;
                this.Char.save_x   = -4811.951f;
                this.Char.save_y   = 15936.05f;
                this.Char.save_z   = 3894f;
            }
            Map map;

            MapManager.Instance.GetMap(this.Char.save_map, out map);
            this.Char.stance = Global.STANCE.REBORN;
            Packets.Server.ActorChangeState p1 = new SagaMap.Packets.Server.ActorChangeState();
            p1.SetActorID(this.Char.id);
            p1.SetBattleState(false);
            p1.SetStance(Global.STANCE.REBORN);
            if (this.Char.Tasks.ContainsKey("AutoSave") == false)
            {
                Tasks.AutoSave newtask = new SagaMap.Tasks.AutoSave(this.client);
                this.Char.Tasks.Add("AutoSave", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("RegenerationHP") == false)
            {
                Tasks.Regeneration newtask = new SagaMap.Tasks.Regeneration(this.client, 2, 0, 1000);
                this.Char.Tasks.Add("RegenerationHP", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("RegenerationSP") == false)
            {
                Tasks.Regeneration newtask = new SagaMap.Tasks.Regeneration(this.client, 0, 35, 4000);
                this.Char.Tasks.Add("RegenerationSP", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("LPReduction") == false)
            {
                Tasks.LPReduction newtask = new SagaMap.Tasks.LPReduction(this.client);
                this.Char.Tasks.Add("LPReduction", newtask);
                newtask.Activate();
            }
            this.Char.BattleStatus = new BattleStatus();
            this.Char.speed        = 500;
            Bonus.BonusHandler.Instance.CalcEquipBonus(this.Char);
            SkillHandler.CastPassivSkill(ref this.client.Char);
            this.client.SendBattleStatus();
            this.client.SendCharStatus(0);
            SkillHandler.SendAllStatusIcons(this.Char, this.Char);
            this.client.netIO.SendPacket(p1, client.SessionID);
        }
Пример #2
0
 public void OnActorAppears(Actor actor)
 {
     if (actor.type == ActorType.PC)
     {
         ActorPC aActor       = (ActorPC)actor;
         Weapon  activeweapon = null;
         //send actorPCInfo
         Packets.Server.ActorPCInfo p1 = new SagaMap.Packets.Server.ActorPCInfo();
         p1.SetActorID(aActor.id);
         p1.SetGender(aActor.sex);
         p1.SetLocation(aActor.x, aActor.y, aActor.z);
         p1.SetYaw(aActor.yaw);
         p1.SetName(aActor.name);
         p1.SetRace(aActor.race);
         p1.SetFace(aActor.face);
         p1.SetDetails(aActor.details);
         foreach (Weapon i in aActor.Weapons)
         {
             if (i.active == 1)
             {
                 activeweapon = i;
             }
         }
         p1.SetEquip(aActor.inv.GetEquipIDs(), aActor.inv.GetEquipDyes(), activeweapon);
         p1.SetJob(aActor.job);
         C.netIO.SendPacket(p1, C.SessionID);
     }
     else if (actor.type == ActorType.NPC)
     {
         ActorNPC aActor = (ActorNPC)actor;
         if (aActor.npcType >= 10000)
         {
             aActor.aStats = new int[0];
         }
         else
         {
             try
             {
                 Npc npc = (Npc)aActor.e;
                 aActor.aStats[0] = Quest.QuestsManager.GetNPCIcon(this.I, npc);
             }
             catch (Exception) { }
         }
         Packets.Server.ActorNPCInfo p1 = new SagaMap.Packets.Server.ActorNPCInfo((byte)aActor.aStats.Length);
         p1.SetActorID(aActor.id);
         p1.SetNPCID(aActor.npcType);
         p1.SetLocation(aActor.x, aActor.y, aActor.z);
         p1.SetYaw(aActor.yaw);
         p1.SetAdditionalStatus(aActor.aStats);
         C.netIO.SendPacket(p1, C.SessionID);
         if (aActor.npcType >= 50000)
         {
             Ship ship = (Ship)aActor.e;
             ship.Map.MoveActor(Map.MOVE_TYPE.START, ship.Actor, null, 0, null, 0, ship.Speed);
         }
     }
     else if (actor.type == ActorType.Item)
     {
         ActorItem aActor = (ActorItem)actor;
         Packets.Server.ActorItemInfo p1 = new SagaMap.Packets.Server.ActorItemInfo();
         p1.SetActorID(aActor.id);
         p1.SetNPCID(aActor.itemtype);
         p1.SetLocation(aActor.x, aActor.y, aActor.z);
         p1.SetYaw(aActor.yaw);
         p1.SetActive(1);
         p1.SetU1(1);
         p1.SetU2(1);
         C.netIO.SendPacket(p1, C.SessionID);
     }
     SkillHandler.SendAllStatusIcons(this.I, actor);
 }
Пример #3
0
        public void OnMapLoaded()
        {
            this.Char.invisble = false;
            this.client.map.OnActorVisibilityChange(this.Char);
            this.client.map.SendTimeWeatherToActor(this.Char);
            this.Char.e.OnMapLoaded();
            this.client.map.SendVisibleActorsToActor(this.Char);
            this.client.SendMaxInvSlots();
            this.client.SendInventoryList();
            this.client.SendEquipList();
            this.client.SendWeaponList();
            this.client.SendSkillList();
            //this.client.SendShortcutsList();
            this.client.SendZeny();
            Quest.QuestsManager.SendNavPoint(this.Char);
            if (!this.client.initialized)
            {
                this.client.SendQuestInfo();
                Scenario.SetCurrentScenario(this.Char, 2, this.Char.Scenario);
                Quest.QuestsManager.UpdateQuestItem(this.Char, true);
                if (Config.Instance.MessageOfTheDay != null)
                {
                    foreach (string i in Config.Instance.MessageOfTheDay)
                    {
                        this.client.SendMessage("Saga", i, SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE_RED);
                    }
                }
                this.client.CheckNewMail();
                this.client.initialized = true;
            }
            if (MapServer.ScriptManager.Scenario != null)
            {
                MapServer.ScriptManager.Scenario.OnChangeMap(this.Char, Char.mapID);
            }
            else
            {
                Logger.ShowDebug("MapServer.ScriptManager.Scenario==null, maybe scenario script is missing?", null);
            }

            if (this.Char.stance == Global.STANCE.DIE)
            {
                this.Char.stance = Global.STANCE.REBORN;
                this.client.map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.CHANGE_STATE, null, this.Char, true);
            }
            if (this.Char.Tasks.ContainsKey("AutoSave") == false)
            {
                Tasks.AutoSave newtask = new SagaMap.Tasks.AutoSave(this.client);
                this.Char.Tasks.Add("AutoSave", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("RegenerationHP") == false)
            {
                Tasks.Regeneration newtask = new SagaMap.Tasks.Regeneration(this.client, 2, 0, 1000);
                this.Char.Tasks.Add("RegenerationHP", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("RegenerationSP") == false)
            {
                Tasks.Regeneration newtask = new SagaMap.Tasks.Regeneration(this.client, 0, 35, 4000);
                this.Char.Tasks.Add("RegenerationSP", newtask);
                newtask.Activate();
            }
            if (this.Char.Tasks.ContainsKey("LPReduction") == false)
            {
                Tasks.LPReduction newtask = new SagaMap.Tasks.LPReduction(this.client);
                this.Char.Tasks.Add("LPReduction", newtask);
                newtask.Activate();
            }
            Bonus.BonusHandler.Instance.CalcEquipBonus(this.Char);
            SkillHandler.CastPassivSkill(ref this.client.Char);
            SkillHandler.CalcHPSP(ref this.client.Char);
            this.client.SendBattleStatus();
            this.Char.LC = this.Char.maxLC;
            this.client.SendCharStatus(0);
            this.client.SendExtStats();
            SkillHandler.SendAllStatusIcons(this.Char, this.Char);
            //if (this.client.Party != null)
            //{
            //    this.client.Party.UpdateMemberInfo(this.client);
            //}
            //this.SendMessage("Saga", "Welcome to Saga!", Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
            Packets.Server.ShowMapInfo p = new SagaMap.Packets.Server.ShowMapInfo();
            p.SetMapInfo(this.Char.MapInfo);
            this.client.netIO.SendPacket(p, client.SessionID);
        }