Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 11:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Sheep Raid ( Event Manager only) [Release]

Discussion on Sheep Raid ( Event Manager only) [Release] within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
Zanouu's Avatar
 
elite*gold: 50
Join Date: Feb 2018
Posts: 151
Received Thanks: 130
Post Sheep Raid ( Event Manager only) [Release]


Code:
using OpenNos.Core;
using OpenNos.Domain;
using OpenNos.GameObject.Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using OpenNos.GameObject.Networking;

namespace OpenNos.GameObject.Event.GAMES
{
	public static class Sheep
	{
		#region Methods

		public static void GenerateSheepGames()
		{
			Thread.Sleep(5 * 1000);
			ServerManager.Instance.Broadcast(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("SHEEP_STARTED"), 1));
			ServerManager.Instance.Broadcast("qnaml 4 #guri^514 Veux-tu participer au raid de la Ferme des moutons ?");
			ServerManager.Instance.EventInWaiting = true;
			Thread.Sleep(30 * 1000);
			ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEventSheep == false).ToList().ForEach(s => s.SendPacket("esf 1"));
			ServerManager.Instance.EventInWaiting = false;

			IEnumerable<ClientSession> sessions = ServerManager.Instance.Sessions.Where(s => s.Character?.IsWaitingForEventSheep == true && s.Character.MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance);
			List<Tuple<MapInstance, byte>> maps = new List<Tuple<MapInstance, byte>>();
			MapInstance map = ServerManager.GenerateMapInstance(2009, MapInstanceType.EventSheepInstance, new InstanceBag());
			maps.Add(new Tuple<MapInstance, byte>(map, 1));
			if (map != null)
			{
				foreach (ClientSession sess in sessions)
				{
					ServerManager.Instance.TeleportOnRandomPlaceInMap(sess, map.MapInstanceId);
					sess.SendPacket("bsinfo 2 4 0 0");
				}
				ServerManager.Instance.Sessions.Where(s => s.Character != null).ToList().ForEach(s => s.Character.IsWaitingForEventSheep = false);
				ServerManager.Instance.StartedEvents.Remove(EventType.SHEEP);

			}

			foreach (Tuple<MapInstance, byte> mapinstance in maps)
			{

				if (mapinstance.Item1.Sessions.Count() < 1)
				{
					mapinstance.Item1.Broadcast(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("INSTANTBATTLE_NOT_ENOUGH_PLAYERS"), 0));
					EventHelper.Instance.ScheduleEvent(TimeSpan.FromSeconds(5), new EventContainer(mapinstance.Item1, EventActionType.DISPOSEMAP, null));
					continue;
				}
				SheepThread task = new SheepThread();
				Observable.Timer(TimeSpan.FromSeconds(10)).Subscribe(X => task.Run(map));
			}
		}



		#endregion

		#region Classes

		public class SheepThread
		{

			public bool Spawn { get; set; }

			#region Members

			private MapInstance _map;

			#endregion

			#region Methods

			public void Run(MapInstance map)
			{
				_map = map;

				foreach (ClientSession session in _map.Sessions)
				{
					ServerManager.Instance.TeleportOnRandomPlaceInMap(session, map.MapInstanceId);
					if (session.Character.IsVehicled)
					{
						session.Character.RemoveVehicle();
					}
					if (session.Character.UseSp)
					{
						session.Character.LastSp = (DateTime.Now - Process.GetCurrentProcess().StartTime.AddSeconds(-50)).TotalSeconds;
						ItemInstance specialist = session.Character.Inventory.LoadBySlotAndType((byte)EquipmentType.Sp, InventoryType.Wear);
						if (specialist != null)
						{
							removeSP(session, specialist.ItemVNum);
						}
					}
					Spawn = true;
					session.Character.CanAttack = true;
					session.Character.Speed = 5;
					session.Character.IsVehicled = true;
					session.Character.IsCustomSpeed = true;
					session.Character.Morph = 1009;
					session.Character.ArenaWinner = 0;
					session.Character.MorphUpgrade = 0;
					session.Character.MorphUpgrade2 = 0;
					session.SendPacket(session.Character.GenerateCond());
					session.Character.LastSpeedChange = DateTime.Now;
					session.CurrentMapInstance?.Broadcast(session.Character.GenerateCMode());
					session.SendPacket($"eff_s 1 {session.Character.CharacterId} 4323");
					_map.Broadcast("srlst 0");
					session.SendPacket("say 1 -1 10 Dans 30 secondes Le raid de la Ferme des moutons commence bientôt.");
					Observable.Timer(TimeSpan.FromSeconds(30)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 10 secondes Le raid de la Ferme des moutons commence bientôt.");
					});
					Observable.Timer(TimeSpan.FromSeconds(35)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 5 secondes Le raid de la Ferme des moutons commence bientôt.");
					});
					Observable.Timer(TimeSpan.FromSeconds(36)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 4 secondes Le raid de la Ferme des moutons commence bientôt.");
					});
					Observable.Timer(TimeSpan.FromSeconds(37)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 3 secondes Le raid de la Ferme des moutons commence bientôt.");
					});
					Observable.Timer(TimeSpan.FromSeconds(38)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 2 secondes Le raid de la Ferme des moutons commence bientôt.");
					});
					Observable.Timer(TimeSpan.FromSeconds(39)).Subscribe(o =>
					{
						session.SendPacket("say 1 -1 10 Dans 1 secondes Le raid de la Ferme des moutons commence bientôt.");

					});
					Observable.Timer(TimeSpan.FromSeconds(50)).Subscribe(o =>
					{
						_map.Broadcast("srlst 3");
						_map.Broadcast("sh_o");
					});
					Observable.Timer(TimeSpan.FromMinutes(5)).Subscribe(o =>
					{

						End(session.Character);
					});
				}

				int i = 0;

				while (_map?.Sessions?.Any() == true)
				{
					runRound(i++);					
				}

				//ended
			}

			private static IEnumerable<Tuple<short, int, short, short>> generateDrop(Map map, short vnum, int amountofdrop, int amount)
			{
				List<Tuple<short, int, short, short>> dropParameters = new List<Tuple<short, int, short, short>>();
				for (int i = 0; i < amountofdrop; i++)
				{
					MapCell cell = map.GetRandomPosition();
					dropParameters.Add(new Tuple<short, int, short, short>(vnum, amount, cell.X, cell.Y));
				}
				return dropParameters;
			}

			private static void removeSP(ClientSession session, short vnum)
			{
				if (session?.HasSession == true && !session.Character.IsVehicled)
				{
					List<BuffType> bufftodisable = new List<BuffType> { BuffType.Bad, BuffType.Good, BuffType.Neutral };
					session.Character.DisableBuffs(BuffType.All);
					//session.Character.EquipmentBCards.RemoveAll(s => s.ItemVNum.Equals(vnum));
					session.Character.UseSp = false;
					session.Character.LoadSpeed();
					session.SendPacket(session.Character.GenerateCond());
					session.SendPacket(session.Character.GenerateLev());
					session.Character.SpCooldown = 30;
					if (session.Character.SkillsSp != null)
					{
						foreach (CharacterSkill ski in session.Character.SkillsSp.Where(s => !s.CanBeUsed()))
						{
							short time = ski.Skill.Cooldown;
							double temp = (ski.LastUse - DateTime.Now).TotalMilliseconds + (time * 100);
							temp /= 1000;
							session.Character.SpCooldown = temp > session.Character.SpCooldown ? (int)temp : session.Character.SpCooldown;
						}
					}
					session.SendPacket(session.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("STAY_TIME"), session.Character.SpCooldown), 11));
					session.SendPacket($"sd {session.Character.SpCooldown}");
					session.CurrentMapInstance?.Broadcast(session.Character.GenerateCMode());
					session.CurrentMapInstance?.Broadcast(UserInterfaceHelper.GenerateGuri(6, 1, session.Character.CharacterId), session.Character.PositionX, session.Character.PositionY);

					// ms_c
					session.SendPacket(session.Character.GenerateSki());
					session.SendPackets(session.Character.GenerateQuicklist());
					session.SendPacket(session.Character.GenerateStat());
					session.SendPacket(session.Character.GenerateStatChar());

					Observable.Timer(TimeSpan.FromMilliseconds(session.Character.SpCooldown * 1000)).Subscribe(o =>
					{
						session.SendPacket(session.Character.GenerateSay(Language.Instance.GetMessageFromKey("TRANSFORM_DISAPPEAR"), 11));
						session.SendPacket("sd 0");
					});
				}
			}

			private void End(Character character)
			{
				character.IsWaitingForGift = true;
				character.Point = 0;
				character.Point2 = 0;
				character.Point3 = 0;
				character.CanAttack = false;
				character.IsCustomSpeed = false;
				character.RemoveVehicle();
				Spawn = false;
				_map.Broadcast("srlst 4");
				_map.Broadcast("srlst 1");
			}

			private void runRound(int number)
			{
				int amount = 120 + (60 * number);

				int i = amount;
				while (i != 0)
				{
					SpawnSheep(number);
					Thread.Sleep(60000 / amount);
					i--;
				}
				Thread.Sleep(70 * 100);
			}

			private void SpawnSheep(int round)
			{
				if (_map != null)
				{
					if (Spawn == true)
					{
						MapCell cell = _map.Map.GetRandomPosition();

						int SheepId = _map.GetNextMonsterId();

						MapMonster sheep = new MapMonster { MonsterVNum = 9, MapX = cell.X, MapY = cell.Y, MapMonsterId = SheepId, IsHostile = false, IsMoving = true, ShouldRespawn = false };
						sheep.Initialize(_map);
						sheep.NoAggresiveIcon = true;
						_map.AddMonster(sheep);
						_map.Broadcast(sheep.GenerateIn());
					}
				}
			}

			#endregion
		}

		#endregion
	}
}
" PS : On achète pas nos sources Nous ! "

ENJOY
Zanouu is offline  
Thanks
6 Users
Old 05/16/2018, 23:55   #2

 
Blowa's Avatar
 
elite*gold: 148
Join Date: Jan 2010
Posts: 654
Received Thanks: 1,774
Quote:
Originally Posted by Zanouu View Post

" PS : On achète pas nos sources Nous ! "

ENJOY
Well done m8, implementation could be improved but its a nice start .

Thanks for your release, leechers will be able to suck it.
Blowa is offline  
Thanks
1 User
Old 05/17/2018, 00:07   #3
 
elite*gold: 0
Join Date: Jul 2017
Posts: 397
Received Thanks: 60
It's funny that you talk about sucking Plowa and very ironic
redbull2905 is offline  
Thanks
1 User
Old 05/17/2018, 01:58   #4
 
elite*gold: 0
Join Date: May 2017
Posts: 104
Received Thanks: 10
very nice @ why you doesnt have a donation link?

regards Glooby21
Glooby21 is offline  
Old 07/18/2018, 19:09   #5
 
elite*gold: 0
Join Date: Jul 2018
Posts: 8
Received Thanks: 0
I do not understand how the script works. Can you explain it to me?
DeadBoy83 is offline  
Old 07/18/2018, 19:23   #6
 
Zanouu's Avatar
 
elite*gold: 50
Join Date: Feb 2018
Posts: 151
Received Thanks: 130
" Script " ???

Is a Sheep Manager ( For Mini-game Sheep )
Zanouu is offline  
Old 08/12/2018, 21:09   #7
 
elite*gold: 0
Join Date: Mar 2018
Posts: 6
Received Thanks: 0
How can i use it?
AzoTheOriginal is offline  
Old 08/12/2018, 23:58   #8
 
Saber none's Avatar
 
elite*gold: 30
Join Date: Sep 2014
Posts: 593
Received Thanks: 316
Quote:
Originally Posted by AzoTheOriginal View Post
How can i use it?
put it into the namespace OpenNos.GameObject.Event.GAMES :O
I am not sure if you need to create a new class, but even if you would need to do so its pretty easy to copy and paste xD
Saber none is offline  
Reply

Tags
sheep raid


Similar Threads Similar Threads
[Selling] [PC ONLY: Destiny 2] Raid, Prestige Raid, Flawless Trials, Prestige Nightfall!
04/16/2018 - Destiny Trading - 3 Replies
My team and I have been playing Destiny 2 for the last few weeks and have been very successful on PC. We figured we would try and help other guardian's out there get what they need and fast! Currently we're selling: 1-20/200 light power leveling. Raid completion (including keys) Prestige Raid completion(including keys) Raid boss completion(prestige included) Prestige Nightfall
[RELEASE] Ship Black Sheep
05/16/2014 - Flyff PServer Guides & Releases - 12 Replies
Hey Leute, ich wollte mal zu Ostern ein kleines Schiff releasen ! Hoffentlich gefällt es Euch und Ihr könnt es gebrauchen ! Viel Spaß damit !!! http://s1.postimg.org/fpuxn1aun/Ship_Ride_Flying_ 2.jpg Download: LINK
[Selling] Power lvling/ Looking for raid/ Proffesion lvling/ Flex raid
12/07/2013 - World of Warcraft Trading - 0 Replies
we offer a wide veriaty of services includeing power lvling, looking for raid, proffesion lvling, flex raid, mount farming and alot more upon request. we also sell gold for the cheapest price around (only on zul'jin server) . we are quick and at the same time very preffesional with getting the job done. we also have a site that you can follow up on at owowitems.com that explains all prices and forms of services. always available on skype at proofmoney2418 i have skype on my phone too so...
Apropros Huhn Raid (Dark) Ich suche Stammi Spieler auf S3 Für den Huhn Raid^^
04/27/2011 - Nostale - 3 Replies
Die Spieler sollten Eier haben, Holly, Gunner, Wk, Ice, Dg, Jäger, Bersi oder Crusi haben^^ Ansonsten Spiele ich heute den Ganzen tag Nos durch T.T Und da kommt schon a bissl lw auf^^ Wenn wir genug sind, könnt ihr auch eure Lows mitnehmen (Ihr kriegt dann 2 Kissten) Aber das Können nicht alle tun! Habe schon ein paar Ig leute die klar mitmachen würden (ca 3-5 Leute) also Meldet euch^^ Ach ja Ich bin in Mom Lv 46 mit Jäger +5 aber mache so gut wie jeden Tag dauerraids auf Ch5 oder 3! ...



All times are GMT +1. The time now is 11:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.