当前位置: 首页>>代码示例>>C#>>正文


C# Database.GetGuild方法代码示例

本文整理汇总了C#中db.Database.GetGuild方法的典型用法代码示例。如果您正苦于以下问题:C# Database.GetGuild方法的具体用法?C# Database.GetGuild怎么用?C# Database.GetGuild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db.Database的用法示例。


在下文中一共展示了Database.GetGuild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Buy

 public override void Buy(Player player)
 {
     if (!player.Guild.IsDefault)
     {
         if (player.Guild[player.AccountId].Rank >= 30)
         {
             using (var db = new Database())
             {
                 if (db.GetGuild(db.GetGuildId(player.Guild[player.AccountId].Name)).GuildFame >= Price)
                 {
                     var cmd = db.CreateQuery();
                     cmd.CommandText = "UPDATE guilds SET level=level+1, [email protected] WHERE [email protected]";
                     cmd.Parameters.AddWithValue("@guildName", player.Guild.Name);
                     cmd.Parameters.AddWithValue("@price", Price);
                     if (cmd.ExecuteNonQuery() == 1)
                     {
                         player.Client.SendPacket(new BuyResultPacket
                         {
                             Message = "{\"key\":\"server.sale_succeeds\"}",
                             Result = -1
                         });
                         player.SendInfo("Please leave the Guild Hall, we need some minutes to update the Guild Hall.");
                         player.Guild.UpdateGuildHall();
                     }
                 }
                 else
                 {
                     player.SendHelp("FUCK");
                     player.Client.SendPacket(new BuyResultPacket
                     {
                         Message = "{\"key\":\"server.not_enough_fame\"}",
                         Result = 9
                     });
                 }
             }
         }
         else
         {
             player.Client.SendPacket(new BuyResultPacket
             {
                 Message = "Founder or Leader rank required.",
                 Result = 0
             });
         }
     }
 }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:46,代码来源:GuildMerchant.cs

示例2: Buy

 public override void Buy(Player player)
 {
     using (var dbx = new Database())
     {
         if (dbx.GetGuild(dbx.GetGuildId(player.Guild)).GuildFame >= Price)
         {
             dbx.DetractGuildFame(dbx.GetGuildId(player.Guild), Price);
             dbx.ChangeGuildLevel(dbx.GetGuildId(player.Guild), nextLevel);
             player.Client.SendPacket(new BuyResultPacket
             {
                 Message = "Upgrade successful! Please leave the Guild Hall to have it upgraded",
                 Result = 0
             });
         }
         else
             player.Client.SendPacket(new BuyResultPacket
             {
                 Message = "Not enough Guild Fame!",
                 Result = 9
             });
     }
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:22,代码来源:GuildMerchant.cs

示例3: JoinGuild

 public void JoinGuild(RealmTime t, JoinGuildPacket pkt)
 {
     var db = new Database();
     var gStruct = db.GetGuild(pkt.GuildName);
     if (psr.Player.Invited == false)
     {
         SendInfo("You need to be invited to join a guild!");
     }
     if (gStruct != null)
     {
         var g = db.ChangeGuild(psr.Account, gStruct.Id, 0, 0, false);
         if (g != null)
         {
             psr.Account.Guild = g;
             Guild = g.Name;
             GuildRank = g.Rank;
             UpdateCount++;
             foreach (var p in RealmManager.GuildMembersOf(g.Name))
             {
                 p.Client.SendPacket(new TextPacket()
                 {
                     BubbleTime = 0,
                     Stars = -1,
                     //Name = "@" + psr.Account.Name + " has joined the guild!"
                     Name = "",
                     Recipient = "*Guild*",
                     Text = psr.Account.Name + " has joined the guild!"
                 });
             }
         }
     }
 }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:32,代码来源:Player.Guilds.cs


注:本文中的db.Database.GetGuild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。