public static Mob GetMob(uint ID, ref ActorNPC actor) { Mob mob; if (!mobs.ContainsKey(ID)) return null; mob = mobs[ID]; Mob newmob = new Mob(); actor.BattleStatus = new BattleStatus(); actor.Tasks = new Dictionary<string, MultiRunTask>(); actor.HP = mob.Actor.maxHP; actor.maxHP = mob.Actor.maxHP; actor.SP = mob.Actor.maxSP; actor.maxSP = mob.Actor.maxSP; actor.level = mob.Actor.level; actor.cEXP = mob.Actor.cEXP; actor.jEXP = mob.Actor.jEXP; actor.wEXP = mob.Actor.wEXP; actor.BattleStatus.def = mob.Actor.BattleStatus.def; actor.BattleStatus.flee = mob.Actor.BattleStatus.flee; newmob.Name = mob.Name; newmob.Type = ID; newmob.MinAtk = mob.MinAtk; newmob.MaxAtk = mob.MaxAtk; newmob.Cri = mob.Cri; actor.BattleStatus.hit = mob.Actor.BattleStatus.hit; newmob.ASPD = mob.ASPD; actor.sightRange = mob.Actor.sightRange; newmob.Size = mob.Size; newmob.WalkSpeed = mob.WalkSpeed; newmob.RunSpeed = mob.RunSpeed; newmob.Actor = actor; newmob.LivingSpace = mob.LivingSpace; actor.e = newmob; newmob.corpsetask = new DeleteCorpse(newmob); return newmob; }
private static void CalcAtkNPC(ref ActorNPC npc) { try { Mob mob = (Mob)npc.e; npc.BattleStatus.atk = Global.Random.Next((int)mob.MinAtk, (int)mob.MaxAtk) + npc.BattleStatus.atkskill; } catch (Exception) { } }
public void ProcessNPC( MapClient client, string args ) { uint npcID; try { npcID = uint.Parse( args ); } catch( Exception ) { npcID = 1; } ActorNPC newNPC = new ActorNPC( npcID, 100, 100, 100, 100 ); if( npcID < 10000 ) { //newNPC.e = new ActorEventHandlers.NPC_EventHandler(newNPC, client.map); newNPC.e = new Npc( newNPC, client.map ); } else//Activate AI for sommoned Mobs { Mob mob = MobFactory.GetMob( newNPC.npcType, ref newNPC ); if (mob == null) { client.SendMessage(_MasterName, "Error, Cannot find mob with ID:" + newNPC.npcType); return; } mob.Map = client.map; mob.ai = new SagaMap.Tasks.MobAI( mob ); mob.ai.Start(); newNPC.e = mob; } newNPC.x = client.Char.x + Global.Random.Next( 100 ); ; newNPC.y = client.Char.y + Global.Random.Next( 100 ); newNPC.z = client.Char.z; newNPC.sightRange = Global.MakeSightRange( 100000 ); newNPC.name = "NPC" + Global.Random.Next().ToString(); if( client.map.RegisterActor( newNPC ) ) client.SendMessage( _MasterName, "Spawned NPC with ID " + npcID ); else client.SendMessage( _MasterName, "Error, cannot spawn the npc" ); }
public void SaveNpc(ActorNPC aNpc) { try { db.Set(aNpc); db.Commit(); } catch (Exception) { Console.WriteLine("Error: can't create new npc in database"); this.isconnected = false; throw new Exception("can't create new npc in database"); } finally { } }
public void SaveNpc( ActorNPC aNpc ) { }
public void DeleteNpc( ActorNPC aNpc ) { }
private static void CalcMAtkNPC(ref ActorNPC npc) { }
public NPC_EventHandler(ActorNPC actor, Map map) { this.I = actor; this.map = map; }
public void OnActorStartsMoving(ActorNPC mActor, byte count, float[] waypoints, ushort speed) { }
public void OnActorStartsMoving(ActorNPC mActor, byte count, float[] waypoints,ushort speed) { if (mActor.npcType < 50000) { Packets.Server.ActorNPCMoveStart p1 = new SagaMap.Packets.Server.ActorNPCMoveStart(count); p1.SetActorID(mActor.id); p1.SetSpeed(speed); p1.SetWaypoints(waypoints); C.netIO.SendPacket(p1, C.SessionID); } else { Ship ship = (Ship)mActor.e; Packets.Server.WideMoveStart p1 = new SagaMap.Packets.Server.WideMoveStart((byte)ship.CurrentWaypoints.Count); p1.SetActorID(mActor.id); p1.SetSpeed(speed); p1.SetWaypoints(ship.CurrentWaypoints, ship.CurrentYaws); C.netIO.SendPacket(p1, C.SessionID); } }
public void SaveNpc(ActorNPC aNpc) { return; }
public void DeleteNpc(ActorNPC aNpc) { return; }
private static void CalcFleeNPC(ref ActorNPC npc) { return; }
private static void CalcHitNPC(ref ActorNPC npc) { if (npc.BattleStatus.hit == 0) npc.BattleStatus.hit = 1; //hit must be greater than 0 }