Command Time/Weather/Sound

Share files with other Dawn of Light users

Moderator: Support Team

Command Time/Weather/Sound

Postby Horizon » Tue Jan 17, 2012 5:24 pm

Here a little command file , a good example to understand the time and weather.
A little thing , actually Instances not use their own TimeManager ....

"/dev sound play <ID> || Play a Sound ID.",
"/dev time <Hour> || Set hour IG.",
"/dev weather on <player> <intensity> <fog>|| Set Storm on player.",
"/dev weather here <intensity> <fog>|| Set Storm on you.",
"/dev weather stophere || Stop Storm on you.")] //usage

Code: Select all
using System;
using System.Collections;
using System.Collections.Generic;
using DOL.GS;
using DOL.GS.PacketHandler;
using DOL.AI.Brain;
using DOL.GS.Effects;
using DOL.Events;
using log4net;
using System.Reflection;
using DOL.GS.Atlantis;
using System.Linq;
using System.Text;

namespace DOL.GS.Commands
{


[CmdAttribute("&dev", //command to handle
ePrivLevel.GM, //minimum privelege level
"Commands for Dev", //command description
"/dev sound play <ID> || Play a Sound ID.",
"/dev time <Hour> || Set hour IG.",
"/dev weather on <player> <intensity> <fog>|| Set Storm on player.",
"/dev weather here <intensity> <fog>|| Set Storm on you.",
"/dev weather stophere || Stop Storm on you.")] //usage
public class SoundInfoCommandHandler : AbstractCommandHandler, ICommandHandler
{

//onCommand
public void OnCommand(GameClient client, string[] args)
{

if (args.Length > 1)
{


switch (args[1].ToLower())
{
#region Sound
case "sound":
{

switch (args[2].ToLower())
{
case "play":
{
if (args[3] != null)
{
client.Player.Out.SendPlaySound(eSoundType.Divers, (ushort)Convert.ToInt16(args[3]));
client.Player.Out.SendMessage("Sound id : " + args[3] + " played !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
client.Player.Out.SendMessage("PLAY", eChatType.CT_System, eChatLoc.CL_SystemWindow);
break;
}
case "list":
{
break;
}
}

client.Player.Out.SendMessage("SOUND", eChatType.CT_System, eChatLoc.CL_SystemWindow);
break;
}
#endregion Sound
#region Time
case "time":
{
if (args[2] != null)
{
try
{
uint ArgConverted = (uint)Convert.ToInt32(args[2]);
if (client.Player.CurrentRegion.IsInstance == true)
{
client.Player.Out.SendMessage("Instance : " + client.Player.CurrentRegion.TimeManager.Name
+ " Running:" + client.Player.CurrentRegion.TimeManager.Running
+ " UseTimeManager" + client.Player.CurrentRegion.UseTimeManager
+ " Time " + client.Player.CurrentRegion.TimeManager.CurrentTime
+ " change to " + ArgConverted + " hours.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
client.Player.CurrentRegion.TimeManager.CurrentTime = ArgConverted * 3600000;
client.Player.Out.SendTime();
}
else
{
WorldMgr.StartDay(24, ArgConverted * 3600000);
client.Player.Out.SendMessage("Time Set to : " + ArgConverted + " hours.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
catch(InvalidCastException e)
{
}
}
break;
}
#endregion Time
#region Weather
case "weather":
{

switch (args[2].ToLower())
{
case "on":
{
if (args[3] != null && args[4] != null && args[5] != null)
{
GamePlayer TheTarget = null;
foreach (GameClient clients in WorldMgr.GetAllPlayingClients())
{
if (clients.Player != null && clients.Player.Name == args[3])
{
TheTarget = clients.Player;
}
}
if (TheTarget == null) return;
WeatherMgr mgr = WeatherMgr.GetWeatherForRegion(TheTarget.CurrentRegionID);
if (mgr == null)
{
DisplayMessage(client, "There is no weather manager for this region!");
return;
}
else
{
uint X = Convert.ToUInt32(TheTarget.X);
uint Y = Convert.ToUInt32(TheTarget.Y);
ushort SPEED = Convert.ToUInt16(100);
ushort INTENSITY = Convert.ToUInt16(args[4]);
ushort FOG = Convert.ToUInt16(args[5]);
mgr.StartStorm(X, Y, SPEED, FOG, INTENSITY);
client.Player.Out.SendMessage("Storm on " + TheTarget.Name + " !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
break;
}
case "here":
{
if (args[3] != null && args[4] != null)
{
WeatherMgr mgr = WeatherMgr.GetWeatherForRegion(client.Player.CurrentRegionID);
if (mgr == null)
{
DisplayMessage(client, "There is no weather manager for this region!");
return;
}
else
{
uint X = Convert.ToUInt32(client.Player.X);
uint Y = Convert.ToUInt32(client.Player.Y);
ushort SPEED = Convert.ToUInt16(100);
ushort INTENSITY = Convert.ToUInt16(args[3]);
ushort FOG = Convert.ToUInt16(args[4]);
mgr.StartStorm(X, Y, SPEED, FOG, INTENSITY);
client.Player.Out.SendMessage("Storm on you !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
break;
}
case "stophere":
{
if (args[3] == null)
{
WeatherMgr mgr = WeatherMgr.GetWeatherForRegion(client.Player.CurrentRegionID);
if (mgr == null)
{
DisplayMessage(client, "There is no weather manager for this region!");
return;
}
else
{
mgr.StartStorm();
client.Player.Out.SendMessage("New storm for this region !", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
break;
}
}

break;
}
#endregion Weather

}


}
else if (args.Length == 1)
{
DisplaySyntax(client);
}


}


}



}
Myrddin - Developper Staff 14/88
Horizon
Contributor
 
Posts: 235
Joined: Fri Mar 25, 2011 7:22 am
Location: Somewhere in DolCore

Re: Command Time/Weather/Sound

Postby Tolakram » Tue Jan 17, 2012 6:25 pm

Excellent, I've wanted to do the weather and time for a while now, specifically to fake out a player with a bogus time, for quests and the like. On my list of things to do this year.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: Command Time/Weather/Sound

Postby Graveen » Tue Jan 17, 2012 7:59 pm

Thank you ! Soon in SVN :)

I wonder if i add this to actual /time /weather.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Command Time/Weather/Sound

Postby Horizon » Tue Jan 17, 2012 8:06 pm

Actual time/weather are strange for me , if i remember well the admin side of time's command change the time speed .Some month ago Faith was turn into the night during mostly days with this feature :D
Not a easy command , maybe a simple /time [hour] for admin is better .

For the weather , i don't remember what is the admin effect.

PS : I writed these commands one year ago to dev on atlantis , inside water with the night ...... sucks.
Myrddin - Developper Staff 14/88
Horizon
Contributor
 
Posts: 235
Joined: Fri Mar 25, 2011 7:22 am
Location: Somewhere in DolCore


Return to “%s” User Files

Who is online

Users browsing this forum: No registered users and 1 guest