本文整理汇总了C#中fCraft.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于fCraft命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CModeWater
internal static void CModeWater(Player player, Command cmd)
{
if (!player.Can(Permissions.ControlPhysics))
{
player.NoAccessMessage(Permissions.ControlPhysics);
return;
}
string blockpar = cmd.Next();
string wmt = "";
int BlockAddr = -1;
try { BlockAddr = Convert.ToInt32(blockpar); }
catch
{
player.Message("Incorrect parameter!"); return;
}
if (BlockAddr < 3 && BlockAddr >= 0)
{
player.world.map.modeWater = BlockAddr;
switch (BlockAddr)
{
case 0: wmt = "'none'"; break;
case 1: wmt = "'infinite'"; break;
case 2: wmt = "'finite'"; break;
}
player.Message("Water mode set to " + wmt + ".");
}
}
示例2: BlockUpdate
public BlockUpdate( Player origin, Vector3I coord, Block blockType ) {
Origin = origin;
X = (short)coord.X;
Y = (short)coord.Y;
Z = (short)coord.Z;
BlockType = blockType;
}
示例3: FuncDrawOperation
protected FuncDrawOperation(Player player, Command cmd)
: base(player)
{
string strFunc = cmd.Next();
if (string.IsNullOrWhiteSpace(strFunc))
{
player.Message("&WEmpty function expression");
return;
}
if (strFunc.Length < 3)
{
player.Message("&WExpression is too short (should be like z=f(x,y))");
return;
}
strFunc = strFunc.ToLower();
_vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc));
_expression = SimpleParser.Parse(strFunc, GetVarArray(_vaxis));
Player.Message("Expression parsed as "+_expression.Print());
string scalingStr=cmd.Next();
_scaler = new Scaler(scalingStr);
}
示例4: BRB
internal static void BRB(Player player, Command cmd)
{
StreamReader streamReader = new StreamReader("plugins/brbMessage.txt");
string message = streamReader.ReadToEnd();
streamReader.Close();
string msg = cmd.NextAll().Trim();
if (player.Info.IsMuted)
{
player.MessageMuted();
return;
}
if (msg.Length > 0)
{
Server.Message("{0}&S &EWill Brb &9({1})",
player.ClassyName, msg);
player.IsAway = true;
return;
}
else
{
Server.Players.Message("&S{0} &EWill Brb &9(" + message + ")", player.ClassyName);
player.IsAway = true;
}
}
示例5: SetParamIteration
public static void SetParamIteration(Player p, CommandReader cmd)
{
string strParam = cmd.Next();
if (string.IsNullOrWhiteSpace(strParam))
{
p.Message("Error: missing param variable name");
return;
}
strParam = strParam.ToLower();
try
{
CheckParamVar(strParam);
double from = ReadDoubleParam(cmd, "lower bound");
double to = ReadDoubleParam(cmd, "upper bound");
double step = ReadDoubleParam(cmd, "step");
if (step == 0 ||
(to - from)/step < 0)
throw new ArgumentException("wrong iteration bounds/step combination");
p.Message("Iteration for " + strParam + " from " + from + " to " + to + " with step " + step + ". " +
((to - from)/step + 1) + " steps.");
GetPlayerParametrizationParamsStorage(p)[VarNameToIdx(strParam[0])] = new double[] {from, to, step};
}
catch (Exception e)
{
p.Message("Error: " + e.Message);
}
}
示例6: SayHandler
static void SayHandler(Player player, CommandReader cmd)
{
if (player.Info.IsMuted)
{
player.MessageMuted();
return;
}
if (player.DetectChatSpam()) return;
if (player.Can(Permission.Say))
{
string msg = cmd.NextAll().Trim();
if (msg.Length > 0)
{
Chat.SendSay(player, msg);
}
else
{
CdSay.PrintUsage(player);
}
}
else
{
player.MessageNoAccess(Permission.Say);
}
}
示例7: TrollHandler
static void TrollHandler(Player player, Command cmd)
{
string Name = cmd.Next();
if (Name == null)
{
player.Message("Player not found. Please specify valid name.");
return;
}
if (!Player.IsValidName(Name))
return;
Player target = Server.FindPlayerOrPrintMatches(player, Name, true, true);
if (target == null)
return;
string options = cmd.Next();
if (options == null)
{
CdTroll.PrintUsage(player);
return;
}
string Message = cmd.NextAll();
if (Message.Length < 1 && options.ToLower() != "leave")
{
player.Message("&WError: Please enter a message for {0}.", target.ClassyName);
return;
}
switch (options.ToLower())
{
case "pm":
if (player.Can(Permission.UseColorCodes) && Message.Contains("%"))
{
Message = Color.ReplacePercentCodes(Message);
}
Server.Players.Message("&Pfrom {0}: {1}",
target.Name, Message);
break;
case "ac":
Chat.SendAdmin(target, Message);
break;
case "st":
case "staff":
Chat.SendStaff(target, Message);
break;
case "i":
case "impersonate":
case "msg":
case "message":
case "m":
Server.Message("{0}&S&F: {1}",
target.ClassyName, Message);
break;
case "leave":
case "disconnect":
case "gtfo":
Server.Players.Message("&SPlayer {0}&S left the server.",
target.ClassyName);
break;
default: player.Message("Invalid option. Please choose st, ac, pm, message or leave");
break;
}
}
示例8: StaffChat
internal static void StaffChat( Player player, Command cmd ) {
if( player.Info.IsMuted ) {
player.MutedMessage();
return;
}
if( DateTime.UtcNow < player.Info.MutedUntil ) {
player.Message( "You are muted for another {0:0} seconds.",
player.Info.MutedUntil.Subtract( DateTime.UtcNow ).TotalSeconds );
return;
}
Player[] plist = Server.PlayerList;
if( plist.Length > 0 ) player.Info.LinesWritten++;
string message = cmd.NextAll();
if( message != null && message.Trim().Length > 0 ) {
message = message.Trim();
if( player.Can( Permission.UseColorCodes ) && message.Contains( "%" ) ) {
message = Color.ReplacePercentCodes( message );
}
for( int i = 0; i < plist.Length; i++ ) {
if( (plist[i].Can( Permission.ReadStaffChat ) || plist[i] == player) && !plist[i].IsIgnoring( player.Info ) ) {
plist[i].Message( "{0}(staff){1}{0}: {2}", Color.PM, player.GetClassyName(), message );
}
}
}
}
示例9: Alice
public Alice(Player player_)
{
player = player_;
myBot = new AIMLbot.Bot();
myUser = new User(player.Name, myBot);//y wont u set my name
Initialize();
}
示例10: FeedData
public FeedData( Block _textType, Vector3I _pos, Bitmap Image, World world, Direction direction_, Player player_ )
{
direction = direction_;
Blocks = new ConcurrentDictionary<string, Vector3I>();
Init( Image, world );
Pos = _pos;
textType = ( byte )_textType;
bgType = ( byte )Block.Air;
FeedData.AddMessages();
MessageCount = 0;
Sentence = FeedData.Messages[MessageCount];
Id = System.Threading.Interlocked.Increment( ref feedCounter );
player = player_;
NormalBrush brush = new NormalBrush( Block.Wood );
DrawOperation Operation = new CuboidWireframeDrawOperation( player );
Operation.AnnounceCompletion = false;
Operation.Brush = brush;
Operation.Context = BlockChangeContext.Drawn;
if ( !Operation.Prepare( new Vector3I[] { StartPos, FinishPos } ) ) {
throw new Exception( "Unable to cubw frame." );
}
Operation.Begin();
AddFeedToList( this, world );
Start();
}
示例11: BlockUpdate
public BlockUpdate( Player _origin, int _x, int _y, int _h, byte _type ) {
origin = _origin;
x = _x;
y = _y;
h = _h;
type = _type;
}
示例12: PayHandler
static void PayHandler(Player player, Command cmd)
{
string targetName = cmd.Next();
string money = cmd.Next();
int amount;
if (money == null)
{
player.Message("&ePlease select the amount of bits you wish to send.");
return;
}
Player target = Server.FindPlayerOrPrintMatches(player, targetName, false, true);
if (target == null)
{
player.Message("&ePlease select a player to pay bits towards.");
return;
}
if (!int.TryParse(money, out amount))
{
player.Message("&ePlease select from a whole number.");
return;
}
PayHandler(player, new Command("/economy pay " + target + " " + money));
}
示例13: DoZone
void DoZone( Player player, Command cmd ) {
if( !player.Can( Permissions.SetSpawn ) ) {
world.NoAccessMessage( player );
return;
}
string name = cmd.Next();
if( name == null ) {
player.Message( "No zone name specified. See " + Color.Help + "/help zone" );
return;
}
if( !Player.IsValidName( name ) ) {
player.Message( "\"" + name + "\" is not a valid zone name" );
return;
}
Zone zone = new Zone();
zone.name = name;
string property = cmd.Next();
if( property == null ) {
player.Message( "No zone rank/whitelist/blacklist specified. See " + Color.Help + "/help zone" );
return;
}
PlayerClass minRank = world.classes.ParseClass( property );
if( minRank != null ) {
zone.buildRank = minRank.rank;
player.tag = zone;
player.marksExpected = 2;
player.marks.Clear();
player.markCount = 0;
player.selectionCallback = MakeZone;
}
}
示例14: SetParametrization
public static void SetParametrization(Player p, Command cmd)
{
string strFunc = cmd.Next();
if (string.IsNullOrWhiteSpace(strFunc))
{
p.Message("Error: empty parametrization expression");
return;
}
if (strFunc.Length < 3)
{
p.Message("Error: expression is too short (should be like x=f(t,u,v))");
return;
}
strFunc = strFunc.ToLower();
try
{
string coordVar = SimpleParser.PreparseAssignment(ref strFunc);
CheckCoordVar(coordVar);
Expression expression = SimpleParser.Parse(strFunc, new string[] { "t", "u", "v" });
p.Message("Expression parsed as " + coordVar + "=" + expression.Print());
GetPlayerParametrizationCoordsStorage(p)[VarNameToIdx(coordVar[0])] = expression;
}
catch (Exception e)
{
p.Message("Error: "+e.Message);
}
}
示例15: FindMainWorld
public static World FindMainWorld( Player player ) {
World rankMain = player.Info.Rank.MainWorld;
if( rankMain != null && player.CanJoin( rankMain ) ) {
return rankMain;
} else {
return MainWorld;
}
}