本文整理汇总了C#中IPlayer.Reply方法的典型用法代码示例。如果您正苦于以下问题:C# IPlayer.Reply方法的具体用法?C# IPlayer.Reply怎么用?C# IPlayer.Reply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer.Reply方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintCost
public void PrintCost(IPlayer player, IInventory inventory)
{
string text = "";
foreach (var pair in cost)
{
text += pair.Key + ": " + inventory.GetItemCount(pair.Key) + "/" + pair.Value + ", ";
}
player.Reply(text);
}
示例2: DigBlock
private void DigBlock(int x, int y, IPlayer player, float digStrength, bool mining, bool explosion = false)
{
if (digHardness == null)
resetDigHardness();
if (!(x > 0 && y > 0 && x < bot.Room.Width && y < bot.Room.Height))
return;
if (digHardness[x, y] <= 0)
return;
IBlock block = bot.Room.getBlock(0, x, y);
int blockId = -1;
float blockXp = 0;
DigPlayer digPlayer = null;
if (player != null)
{
if (!player.HasMetadata("digplayer"))
player.SetMetadata("digplayer", new DigPlayer(player));
digPlayer = (DigPlayer)player.GetMetadata("digplayer");
}
if (mining)
{
InventoryItem temp = ItemManager.GetItemFromOreId(block.Id);
if (temp != null)
{
Ore ore = ItemManager.GetOreByName(temp.Name);
blockId = 414;
if (digPlayer.digLevel >= Convert.ToInt32(ore.LevelRequired))
{
if (digHardness[x, y] <= digStrength)
{
digHardness[x, y] = 0F;
InventoryItem newsak = new InventoryItem(temp);
digPlayer.Inventory.AddItem(newsak, 1);
int oldLevel = digPlayer.digLevel;
digPlayer.digXp += Convert.ToInt32(ore.XPGain);
int newLevel = digPlayer.digLevel;
if (newLevel > oldLevel)
player.Reply("You have leveled up to level " + newLevel + "!");
}
}
else
{
return;
}
}
}
if (explosion)
blockId = 414;
switch (block.Id)
{
case BlockIds.Blocks.Sand.BROWN:
blockId = 414;
blockXp = 0.08f;
break;
case BlockIds.Blocks.Sand.GRAY:
blockId = 414;
blockXp = 0.1f;
break;
case 1022: // gray bricks
blockId = 414;
blockXp = 0.2f;
break;
case BlockIds.Blocks.JungleRuins.BLUE:
blockId = BlockIds.Action.Liquids.WATER;
blockXp = 0.1f;
break;
case 21:
blockId = 369; //BlockIds.Action.Liquids.MUD;
blockXp = 0.1f;
break;
default:
if (blockId == -1)
return;
else
break;
}
digHardness[x, y] -= digStrength;
if (digHardness[x, y] <= 0)
{
digHardness[x, y] = 0f;
bot.Room.setBlock(x, y, new NormalBlock(blockId));
//.........这里部分代码省略.........
示例3: ShowHouses
public void ShowHouses(IPlayer player)
{
List<string> houseTypeNames = new List<string>();
foreach (HouseType h in houseTypes.Values)
houseTypeNames.Add(h.Name);
string text = "You can build these houses: ";
for (int i = 0; i < houseTypeNames.Count; ++i)
{
if (i == houseTypeNames.Count - 1)
text += houseTypeNames[i];
else
text += houseTypeNames[i] + ", ";
}
player.Reply(text);
}
示例4: CanBuy
public bool CanBuy(IPlayer player)
{
//MasterDig.DigPlayer digPlayer = MasterDig.DigPlayer.FromPlayer(player);
IInventoryContainer inventoryPlayer = (IInventoryContainer)player.GetMetadata("digplayer");
// Check if we can buy the house.
foreach (var pair in cost)
{
if (inventoryPlayer.Inventory.GetItemCount(pair.Key) < pair.Value)
{
player.Reply("You don't have enough resources to build " + this.name + ".");
PrintCost(player, inventoryPlayer.Inventory);
return false;
}
}
return true;
}
示例5: ListHouseTypes
public void ListHouseTypes(IPlayer player)
{
player.Reply("TODO: ListHouseTypes");
}
示例6: FinishHouse
public void FinishHouse(IPlayer builder)
{
if (buildingHouses.ContainsKey(builder))
{
House house = buildingHouses[builder];
if (builder.BlockX < house.x || builder.BlockX >= house.x + house.width
|| builder.BlockY < house.y || builder.BlockY >= house.y + house.height)
{
buildingHouses.Remove(builder);
Save();
builder.Reply("You got a nice house there! :P");
}
else
{
builder.Reply("You must go out from your house to finish it!");
}
}
else
builder.Reply("You are not building any house. Say '!build house' to build a house.");
}
示例7: BuildHouse
public bool BuildHouse(IPlayer builder, string houseTypeStr)
{
if (buildingHouses.ContainsKey(builder))
{
builder.Reply("You are already building a house, use !finishhouse to finish it.");
return false;
}
if (houses.ContainsKey(builder.Name))
{
builder.Reply("You already have a house. Use !destroyhouse to delete it. ;)");
return false;
}
HouseType houseType = null;
if (!houseTypes.ContainsKey(houseTypeStr))
{
builder.Reply("There is no building called '" + houseTypeStr + "'!");
ShowHouses(builder);
return false;
}
houseType = houseTypes[houseTypeStr];
// Make sure the player cna buy the house!
if (!houseType.CanBuy(builder))
{
//builder.Reply("You don't have enough resources to build " + houseType.Name + ".");
//houseType.PrintCost(builder);
return false;
}
int x = builder.BlockX - houseType.Width / 2;
int y = builder.BlockY - houseType.Height / 2;
House house = new House(houseType, builder.Name, x, y, houseType.Width, houseType.Height, HouseState.Building);
if (!isValidHousePosition(house))
return false;
buildingHouses.Add(builder, house);
houses.Add(builder.Name, house);
DrawHouse(house, builder);
bot.ChatSayer.Command("/tp " + builder.Name + " " + builder.BlockX + " " + builder.BlockY);
// Nothing went wrong, let the player pay for his house.
houseType.Buy(builder);
return true;
}
示例8: PlaceFurniture
public bool PlaceFurniture(IPlayer player, Furniture furniture)
{
House house = houseManager.FindHouse(furniture.X, furniture.Y);
lock (this)
{
if (house == null)
{
player.Reply("You're not inside any house!");
return false;
}
if (house.builder != player)
{
player.Reply("You can only place furnitures in your own houses!");
return false;
}
if (furnitures.ContainsKey(new BlockPos(0, furniture.X, furniture.Y)))
{
player.Reply("There's already a furniture there somehow...");
return false;
}
bot.Room.setBlock(furniture.X, furniture.Y, furniture.getBlock());
furniture.setHouse(house);
furnitures.Add(new BlockPos(0, furniture.X, furniture.Y), furniture);
return true;
}
}
示例9: BuildHouse
public bool BuildHouse(IPlayer builder, string houseTypeStr)
{
if (buildingHouses.ContainsKey(builder))
return false;
HouseType houseType = null;
if (!houseTypes.ContainsKey(houseTypeStr))
{
builder.Reply("There is no building called '" + houseTypeStr + "'!");
List<string> houseTypeNames = new List<string>();
foreach(HouseType h in houseTypes.Values)
houseTypeNames.Add(h.Name);
string text = "You can build this: ";
for (int i = 0; i < houseTypeNames.Count; ++i)
{
if (i == houseTypeNames.Count - 1)
text += houseTypeNames[i];
else
text += houseTypeNames[i] + ", ";
if (i % 4 == 3 || i == 2 || i == houseTypeNames.Count - 1)
{
builder.Reply(text);
text = "";
}
}
return false;
}
houseType = houseTypes[houseTypeStr];
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
//int cost = houseType.Cost; ?
MasterDig.DigPlayer digPlayer = MasterDig.DigPlayer.FromPlayer(builder);
if (digPlayer.inventory.GetItemCount("stone") > 5)
{
digPlayer.inventory.RemoveItem("stone", 5);
}
else
{
builder.Reply("You do not have enough resources to build this house type!");
return false;
}
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
//////////TITTA HÄRRRRRRRRRRRRRRRRRR
int x = builder.BlockX - houseType.Width/2;
int y = builder.BlockY - houseType.Height/2;
House house = new House(houseType, builder, x, y, houseType.Width, houseType.Height, HouseState.Building);
if (!isValidHousePosition(house))
return false;
buildingHouses.Add(builder, house);
houses.Add(house);
for (int xx = 0; xx < houseType.Width; ++xx)
{
for (int yy = 0; yy < houseType.Height; ++yy)
{
int blockId = 22;
int backgroundBlock = houseType.BackgroundBlock;
if (xx == 0 || xx == houseType.Width - 1 || yy == 0 || yy == houseType.Height - 1)
{
blockId = houseType.WallBlock;
}
else
{
blockId = houseType.BaseBlock;
}
if (builder.BlockX != x + xx || builder.BlockY != y + yy)
{
this.bot.Room.BlockDrawer.PlaceBlock(
new Room.Block.BlockWithPos(xx + x, yy + y,
new Room.Block.NormalBlock(blockId)));
}
this.bot.Room.BlockDrawer.PlaceBlock(
new Room.Block.BlockWithPos(xx + x, yy + y,
new Room.Block.NormalBlock(backgroundBlock)));
}
}
bot.Say("/tp " + builder.Name + " " + builder.BlockX + " " + builder.BlockY);
//.........这里部分代码省略.........