Merge pull request #69 from advocaite/master

Banner Fix
This commit is contained in:
pr701 2023-01-18 21:15:28 +03:00 committed by GitHub
commit 4e1d41c8da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 1105 additions and 207 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blizzless", "DiIiS-NA\Blizzless.csproj", "{535AC91E-54D1-4044-B4A5-B78AE1570EE3}"
EndProject
@ -10,15 +10,20 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
github|Any CPU = github|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.github|Any CPU.ActiveCfg = github|Any CPU
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.github|Any CPU.Build.0 = github|Any CPU
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{535AC91E-54D1-4044-B4A5-B78AE1570EE3}.Release|Any CPU.Build.0 = Release|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.github|Any CPU.ActiveCfg = github|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.github|Any CPU.Build.0 = github|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73D9E87F-1F75-4D94-A47B-29354B9BCF13}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

View File

@ -75,6 +75,35 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
Logger.Warn("Created account {0}", email);
return GetAccountByEmail(email);
}
public static bool BindDiscordAccount(string email, ulong discordId, string discordTag)
{
try
{
if (DBSessions.SessionQueryWhere<DBAccount>(dba => dba.DiscordId == discordId).Count() > 0)
return false;
var account = GetAccountByEmail(email);
account.DBAccount.DiscordTag = discordTag;
account.DBAccount.DiscordId = discordId;
DBSessions.SessionUpdate(account.DBAccount);
return true;
}
catch (Exception e)
{
Logger.DebugException(e, "BindDiscordAccount() exception: ");
return false;
}
}
public static Account GetAccountByDiscordId(ulong discordId)
{
List<DBAccount> dbAcc = DBSessions.SessionQueryWhere<DBAccount>(dba => dba.DiscordId == discordId).ToList();
if (dbAcc.Count() == 0)
{
Logger.Warn("GetAccountByDiscordId {0}: DBAccount is null!", discordId);
return null;
}
return GetAccountByDBAccount(dbAcc.First());
}
public static bool GenerateReferralCode(string email)
{

View File

@ -10,6 +10,7 @@
<FileVersion>3.0.0.0</FileVersion>
<StartupObject>DiIiS_NA.Program</StartupObject>
<DebugType>full</DebugType>
<Configurations>Debug;Release;github</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -27,6 +28,10 @@
<IlcGenerateStackTraceData>true</IlcGenerateStackTraceData>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='github|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<TrimmerRootAssembly Include="mscorlib" />
<TrimmerRootAssembly Include="System.Runtime" />
@ -64,6 +69,7 @@
<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Discord.Net" Version="3.8.0" />
<PackageReference Include="DotNetty.Buffers" Version="0.6.0" />
<PackageReference Include="DotNetty.Codecs" Version="0.6.0" />
<PackageReference Include="DotNetty.Codecs.Http" Version="0.6.0" />
@ -85,6 +91,7 @@
<PackageReference Include="Skater.exe" Version="7.5.0" />
<PackageReference Include="SoapCore" Version="0.9.9.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.ServiceModel.Web" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
@ -95,7 +102,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="config.ini">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="database.Account.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

View File

@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using DiIiS_NA.Core.Discord.Services;
using DiIiS_NA.LoginServer.AccountsSystem;
using DiIiS_NA.Core.Logging;
using DiIiS_NA.Core.Storage;
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
namespace DiIiS_NA.Core.Discord
{
public class Bot
{
private static readonly Logger Logger = LogManager.CreateLogger();
public static void Init()
=> new Bot().MainAsync().GetAwaiter().GetResult();
public DiscordSocketClient Client = null;
private DiscordSocketConfig _config = new DiscordSocketConfig{MessageCacheSize = 100};
public async Task MainAsync()
{
var services = ConfigureServices();
this.Client = services.GetService<DiscordSocketClient>();
await services.GetService<CommandHandlingService>().InitializeAsync();
await this.Client.LoginAsync(TokenType.Bot, Config.Instance.Token);
await this.Client.StartAsync();
this.Client.ReactionAdded += HandleReactionAsync;// ReactionAdded;
//await Task.Delay(-1);
}
private IServiceProvider ConfigureServices()
{
return new ServiceCollection()
// Base
.AddSingleton(new DiscordSocketClient(_config))
.AddSingleton<CommandService>()
.AddSingleton<CommandHandlingService>()
// Add additional services here...
.BuildServiceProvider();
}
private async Task HandleReactionAsync(Cacheable<IUserMessage, ulong> message, Cacheable<IMessageChannel, ulong> channel, SocketReaction reaction)
{
if (this.Client.GetUser(reaction.UserId).IsBot) return;
// If the message was not in the cache, downloading it will result in getting a copy of it.
var msg = await message.GetOrDownloadAsync();
if (channel.Id == (ulong)DiIiS_NA.Core.Discord.Config.Instance.EventsChannelId)
{
var user = reaction.User.Value;
var guild_user = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetUser(user.Id);
if (!guild_user.Roles.Select(r => r.Id).Contains((ulong)DiIiS_NA.Core.Discord.Config.Instance.BaseRoleId) && !guild_user.IsBot)
{
await msg.RemoveReactionAsync(reaction.Emote, reaction.User.Value);
await user.SendMessageAsync("**Your #💎events entry has been removed because your Blizzless account isn't linked to Discord!**\nYou can do that if you send me:\n\n`!email my_d3r_email@something.com`\n\n**(Replace** `my_d3r_email@something.com` **with your D3 Reflection email)**");
}
}
}
public async Task AddCollectorRole(ulong userId)
{
try
{
var user = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetUser(userId);
await user.AddRoleAsync(this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetRole((ulong)DiIiS_NA.Core.Discord.Config.Instance.CollectorRoleId));
await user.SendMessageAsync("Congratulations! You are now a **Collector**.");
}
catch (Exception e)
{
Logger.WarnException(e, "AddCollectorRole() exception: ");
}
}
public async Task AddPremiumRole(ulong userId)
{
try
{
var user = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetUser(userId);
await user.AddRoleAsync(this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetRole((ulong)DiIiS_NA.Core.Discord.Config.Instance.PremiumRoleId));
await user.SendMessageAsync("Congratulations! You are now a **Premium** user.");
}
catch (Exception e)
{
Logger.WarnException(e, "AddPremiumRole() exception: ");
}
}
public async Task UpdateBattleTag(ulong userId, string btag)
{
try
{
var user = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetUser(userId);
await user.AddRoleAsync(this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetRole((ulong)DiIiS_NA.Core.Discord.Config.Instance.PremiumRoleId));
await user.ModifyAsync(x => {x.Nickname = btag;});
}
catch (Exception e)
{
Logger.WarnException(e, "UpdateBattleTag() exception: ");
}
}
public async Task ClearPremiumRoles(List<ulong> userIds)
{
try
{
var guild = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId);
var role = guild.GetRole((ulong)DiIiS_NA.Core.Discord.Config.Instance.PremiumRoleId);
foreach (var userId in userIds)
{
try
{
var user = guild.GetUser(userId);
await user.RemoveRoleAsync(role);
} catch {}
}
}
catch (Exception e)
{
Logger.WarnException(e, "ClearPremiumRoles() exception: ");
}
}
public async Task ShowServerStats()
{
try
{
var guild = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId);
var channelId = (ulong)DiIiS_NA.Core.Discord.Config.Instance.StatsChannelId;
string opened = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "ServerOpened").First().Value > 0 ? "ENABLED" : "DISABLED";
// int gs_count = Program.MooNetServer.MooNetBackend.GameServers.Count;
// int ccu = DiIiS_NA.Core.MooNet.Online.PlayerManager.OnlinePlayers.Count;
// int games = DiIiS_NA.Core.MooNet.Games.GameFactoryManager.GamesOnline;
var messages = await guild.GetTextChannel(channelId).GetMessagesAsync(10).FlattenAsync();
await guild.GetTextChannel(channelId).DeleteMessagesAsync(messages);
// await guild.GetTextChannel(channelId).SendMessageAsync($"Login availability: **{opened}**\nGame servers available: {gs_count}\nPlayers online: {ccu}\nGames online: {games}");
}
catch (Exception e)
{
Logger.WarnException(e, "ShowStats() exception: ");
}
}
public async Task StartGiveaway()
{
try
{
var guild = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId);
var channelId = (ulong)DiIiS_NA.Core.Discord.Config.Instance.EventsChannelId;
var param_message = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "DiscordGiveawayPostId");
if (param_message.Count < 1)
{
var messages = await guild.GetTextChannel(channelId).GetMessagesAsync(10).FlattenAsync();
await guild.GetTextChannel(channelId).DeleteMessagesAsync(messages);
}
else
{
await guild.GetTextChannel(channelId).DeleteMessageAsync(param_message.First().Value);
}
var eb = new EmbedBuilder();
eb.WithTitle("Reward: 7 days of Premium");
eb.WithDescription("Click <:wolfRNG:607868292979490816> to join.\nEnds at 18:00 UTC");
eb.WithFooter("You must bind your D3R account email to be able to join!");
eb.WithColor(Color.Blue);
var mes = await guild.GetTextChannel(channelId).SendMessageAsync("@here \n <:wolfRNG:607868292979490816> **GIVEAWAY ROULETTE!** <:wolfRNG:607868292979490816>", false, eb.Build());
//var giveaway_message = await guild.GetTextChannel(channelId).GetMessagesAsync(1).FlattenAsync();
//foreach (var mes in giveaway_message)
//{
var param = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "DiscordGiveawayPostId");
if (param.Count < 1)
{
var new_param = new DBGlobalParams{
Name = "DiscordGiveawayPostId",
Value = mes.Id
};
DBSessions.SessionSave(new_param);
}
else
{
var postId = param.First();
postId.Value = mes.Id;
DBSessions.SessionUpdate(postId);
}
await (mes as IUserMessage).AddReactionAsync(Emote.Parse("<:wolfRNG:607868292979490816>"));
//}
}
catch (Exception e)
{
Logger.WarnException(e, "StartGiveaway() exception: ");
}
}
public async Task FinishGiveaway()
{
try
{
var guild = this.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId);
var channelId = (ulong)DiIiS_NA.Core.Discord.Config.Instance.EventsChannelId;
bool haveWinner = true;
string winnerName = "";
var param = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "DiscordGiveawayPostId");
if (param.Count < 1)
{
haveWinner = false;
}
else
{
if (param.First().Value > 0)
{
var message = await guild.GetTextChannel(channelId).GetMessageAsync(param.First().Value);
var reactedUsers = await (message as IUserMessage).GetReactionUsersAsync(Emote.Parse("<:wolfRNG:607868292979490816>"), 100).FlattenAsync();
var contestants = reactedUsers.Where(u => !u.IsBot).ToList();
if (contestants.Count() > 0)
{
var winner = reactedUsers.Where(u => !u.IsBot).ToList()[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, reactedUsers.Count() - 1)];
winnerName = guild.GetUser(winner.Id).Nickname;
await winner.SendMessageAsync("Congratulations! You have won **7 days of D3 Reflection Premium**!.\nYour account has already had its Premium prolonged. Have a nice game!");
var acc = AccountManager.GetAccountByDiscordId(winner.Id);
if (acc != null) {
//acc.UpdatePremiumTime(7);
}
}
else
haveWinner = false;
}
else
haveWinner = false;
}
if (param.Count < 1)
{
var messages = await guild.GetTextChannel(channelId).GetMessagesAsync(10).FlattenAsync();
await guild.GetTextChannel(channelId).DeleteMessagesAsync(messages);
}
else
{
await guild.GetTextChannel(channelId).DeleteMessageAsync(param.First().Value);
}
var eb = new EmbedBuilder();
eb.WithTitle("Giveaway ended");
eb.WithDescription(haveWinner ? string.Format("Winner: {0}", winnerName) : "We have no winner this time :(");
eb.WithFooter("Free Premium giveaways - starts every Friday and Saturday!");
eb.WithColor(Color.Red);
var mes = await guild.GetTextChannel(channelId).SendMessageAsync("<:wolfRNG:607868292979490816> **GIVEAWAY ROULETTE!** <:wolfRNG:607868292979490816>", false, eb.Build());
var db_param = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "DiscordGiveawayPostId");
if (db_param.Count < 1)
{
var new_param = new DBGlobalParams{
Name = "DiscordGiveawayPostId",
Value = mes.Id
};
DBSessions.SessionSave(new_param);
}
else
{
var postId = db_param.First();
postId.Value = mes.Id;
DBSessions.SessionUpdate(postId);
}
}
catch (Exception e)
{
Logger.WarnException(e, "FinishGiveaway() exception: ");
}
}
}
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2011 - 2012 DiIiS_NA project - http://www.DiIiS_NA.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
*/
namespace DiIiS_NA.Core.Discord
{
public sealed class Config : Core.Config.Config
{
public bool Enabled { get { return this.GetBoolean("Enabled", false); } set { this.Set("Enabled", value); } }
public bool MonitorEnabled { get { return this.GetBoolean("MonitorEnabled", true); } set { this.Set("MonitorEnabled", value); } }
public string Token { get { return this.GetString("Token", ""); } set { this.Set("Token", value); } }
public long GuildId { get { return this.GetLong("GuildId", 0); } set { this.Set("GuildId", value); } }
public long AnnounceChannelId { get { return this.GetLong("AnnounceChannelId", 0); } set { this.Set("AnnounceChannelId", value); } }
public long StatsChannelId { get { return this.GetLong("StatsChannelId", 0); } set { this.Set("StatsChannelId", value); } }
public long EventsChannelId { get { return this.GetLong("EventsChannelId", 0); } set { this.Set("EventsChannelId", value); } }
public long BaseRoleId { get { return this.GetLong("BaseRoleId", 0); } set { this.Set("BaseRoleId", value); } }
public long PremiumRoleId { get { return this.GetLong("PremiumRoleId", 0); } set { this.Set("PremiumRoleId", value); } }
public long CollectorRoleId { get { return this.GetLong("CollectorRoleId", 0); } set { this.Set("CollectorRoleId", value); } }
private static readonly Config _instance = new Config();
public static Config Instance { get { return _instance; } }
private Config() : base("Discord") { }
}
}

View File

@ -0,0 +1,115 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Mail;
using DiIiS_NA.LoginServer.AccountsSystem;
using DiIiS_NA.Core.Storage;
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
using Discord;
using Discord.Commands;
namespace DiIiS_NA.Core.Discord.Modules
{
public class AuthModule : ModuleBase<SocketCommandContext>
{
[Command("register")]
public async Task Register([Remainder] string args)
{
string dtag = Context.User.Username + "#" + Context.User.Discriminator;
string[] registerInfo = args.Split(null);
var email = registerInfo[0];
var password = registerInfo[1];
var battleTagName = registerInfo[2];
var userLevel = Account.UserLevels.User;
if (!(Context.Channel is IDMChannel))
{
await Context.Guild.GetTextChannel(Context.Channel.Id).DeleteMessageAsync(Context.Message);
await ReplyAsync($"<@{Context.User.Id}> that command could be used only via direct message!\nDon't show your e-mail to anyone, don't be a fool! <:200iq:538833204421984286>");
return;
}
if (registerInfo.Count() == 3)
{
if (!email.Contains('@'))
{
await ReplyAsync($"<@{Context.User.Id}> " + string.Format("'{0}' is not a valid email address.", email));
return;
}
if (!IsValid(email))
{
await ReplyAsync("Your e-mail address is invalid!");
return;
}
if (battleTagName.Contains('#'))
{
await ReplyAsync($"<@{Context.User.Id}> BattleTag must not contain '#' or HashCode.");
return;
}
if (password.Length < 8 || password.Length > 16)
{
await ReplyAsync($"<@{Context.User.Id}> Password should be a minimum of 8 and a maximum of 16 characters.");
return;
}
if (AccountManager.GetAccountByEmail(email) != null)
{
await ReplyAsync($"<@{Context.User.Id}> " + string.Format("An account already exists for email address {0}.", email));
return;
}
var account = AccountManager.CreateAccount(email, password, battleTagName, userLevel);
var gameAccount = GameAccountManager.CreateGameAccount(account);
var guild_user = Context.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetUser(Context.User.Id);
if (guild_user == null)
{
await ReplyAsync("Your Discord account is not participated channel!");
return;
}
if (AccountManager.BindDiscordAccount(email, Context.User.Id, dtag))
{
var accountcheck = AccountManager.GetAccountByEmail(email);
string battle_tag = account.DBAccount.BattleTagName + "#" + account.DBAccount.HashCode;
await ReplyAsync($"Account registered.\nYour Discord account has been successfully bound to {battle_tag}!");
await guild_user.AddRoleAsync(Context.Client.GetGuild((ulong)DiIiS_NA.Core.Discord.Config.Instance.GuildId).GetRole((ulong)DiIiS_NA.Core.Discord.Config.Instance.BaseRoleId));
await ReplyAsync("You are now **DemonSlayer**!");
try
{
await guild_user.ModifyAsync(x => { x.Nickname = battle_tag; });
}
catch
{ }
}
else
await ReplyAsync("An error occured: make sure your Discord account hasn't already been bound to another account.!");
}
else
{
await ReplyAsync("Incorrect usage: !register <email> <password> <battletag>.!");
}
}
private bool IsValid(string emailaddress)
{
try
{
MailAddress m = new MailAddress(emailaddress);
return true;
}
catch (FormatException)
{
return false;
}
}
}
}

View File

@ -0,0 +1,39 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using DiIiS_NA.Core.Storage;
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
namespace DiIiS_NA.Core.Discord.Modules
{
public class EventsModule : ModuleBase<SocketCommandContext>
{
private ulong EventsChannelId
{
get
{
return (ulong)DiIiS_NA.Core.Discord.Config.Instance.EventsChannelId;
}
set{}
}
[Command("announce_event")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task SalesAnnounce()
{
var eb = new EmbedBuilder();
eb.WithTitle("New Event");
eb.WithDescription("Event Description.");
eb.WithFooter("Ends 4th Dec 2022.\nStay at home!");
eb.WithColor(Color.Green);
await Context.Guild.GetTextChannel(EventsChannelId).SendMessageAsync("<:party:> **NEW EVENT!** <:party:>", false, eb.Build());
}
}
}

View File

@ -0,0 +1,116 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using DiIiS_NA.Core.Extensions;
using DiIiS_NA.Core.Storage;
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
using DiIiS_NA.Core.Storage;
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
using DiIiS_NA.LoginServer.Battle;
using DiIiS_NA.LoginServer.GamesSystem;
namespace DiIiS_NA.Core.Discord.Modules
{
public class InfoModule : ModuleBase<SocketCommandContext>
{
private ulong AnnounceChannelId
{
get
{
return (ulong)DiIiS_NA.Core.Discord.Config.Instance.AnnounceChannelId;
}
set{}
}
private ulong StatsChannelId
{
get
{
return (ulong)DiIiS_NA.Core.Discord.Config.Instance.StatsChannelId;
}
set{}
}
[Command("about")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task Info()
{
await ReplyAsync($"Hello, I am a bot called {Context.Client.CurrentUser.Username} written for Blizzless Server\nSpecial Thanks to those who want it.");
}
[Command("ping")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task PingAsync()
{
await ReplyAsync("pong!");
}
[Command("list_online")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task ListOnline()
{
int ccu = PlayerManager.OnlinePlayers.Count;
string players = "";
foreach (var plr in PlayerManager.OnlinePlayers)
{
players += plr.Account.BattleTag;
players += "\n";
}
await ReplyAsync(string.Format("Total players online: {0}\n{1}", ccu, players));
}
[Command("lock")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task Lock()
{
var param = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "ServerOpened").First();
param.Value = 0;
DBSessions.SessionUpdate(param);
await ReplyAsync("Login availability now **DISABLED**");
}
[Command("unlock")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task Unlock()
{
var param = DBSessions.SessionQueryWhere<DBGlobalParams>(dbgp => dbgp.Name == "ServerOpened").First();
param.Value = 1;
DBSessions.SessionUpdate(param);
await ReplyAsync("Login availability now **ENABLED**");
}
[Command("maintenance")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task MaintenanceAnnounce([Remainder]int minutes)
{
//notify players maintenance is enabled
var messages = await Context.Guild.GetTextChannel(AnnounceChannelId).GetMessagesAsync(10).FlattenAsync();
await Context.Guild.GetTextChannel(AnnounceChannelId).DeleteMessagesAsync(messages);
await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync("Servers status: :tools: **PLANNED MAINTENANCE**.");
await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync($"@here Servers will be restarted in **{minutes}** minutes for a planned maintenance.\n----\nСерверы будут перезагружены через **{minutes}** минут для плановых профилактических работ.");
}
[Command("online")]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task OnlineAnnounce()
{
var messages = await Context.Guild.GetTextChannel(AnnounceChannelId).GetMessagesAsync(10).FlattenAsync();
await Context.Guild.GetTextChannel(AnnounceChannelId).DeleteMessagesAsync(messages);
await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync("Servers status: :white_check_mark: **ONLINE**.");
await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync("@here Servers are up and running.\n");
}
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using DiIiS_NA.Core.Logging;
namespace DiIiS_NA.Core.Discord.Services
{
public class CommandHandlingService
{
private static readonly Logger Logger = LogManager.CreateLogger();
private readonly CommandService _commands;
private readonly DiscordSocketClient _discord;
private readonly IServiceProvider _services;
public CommandHandlingService(IServiceProvider services)
{
_commands = services.GetService<CommandService>();
_discord = services.GetService<DiscordSocketClient>();
_services = services;
// Hook CommandExecuted to handle post-command-execution logic.
_commands.CommandExecuted += CommandExecutedAsync;
// Hook MessageReceived so we can process each message to see
// if it qualifies as a command.
_discord.MessageReceived += MessageReceivedAsync;
}
public async Task InitializeAsync()
{
// Register modules that are public and inherit ModuleBase<T>.
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
}
public async Task MessageReceivedAsync(SocketMessage rawMessage)
{
try
{
// Ignore system messages, or messages from other bots
if (!(rawMessage is SocketUserMessage message)) return;
if (message.Source != MessageSource.User) return;
//if (!(message.Channel is SocketTextChannel textChannel)) return;
//if (textChannel.Name != DiIiS_NA.Core.Discord.Config.Instance.ConsoleChannel) return;
// This value holds the offset where the prefix ends
var argPos = 0;
// Perform prefix check. You may want to replace this with
if (!message.HasCharPrefix('!', ref argPos)) return;
// for a more traditional command format like !help.
//if (!message.HasMentionPrefix(_discord.CurrentUser, ref argPos)) return;
var context = new SocketCommandContext(_discord, message);
// Perform the execution of the command. In this method,
// the command service will perform precondition and parsing check
// then execute the command if one is matched.
Logger.BotCommand("[{0}]: {1}", message.Author.Username, message.Content);
await _commands.ExecuteAsync(context, argPos, _services);
// Note that normally a result will be returned by this format, but here
// we will handle the result in CommandExecutedAsync,
}
catch (Exception e)
{
Logger.DebugException(e, "Discord exception: ");
}
}
public async Task CommandExecutedAsync(Optional<CommandInfo> command, ICommandContext context, IResult result)
{
// command is unspecified when there was a search failure (command not found); we don't care about these errors
if (!command.IsSpecified)
return;
// the command was successful, we don't care about this result, unless we want to log that a command succeeded.
if (result.IsSuccess)
return;
// the command failed, let's notify the user that something happened.
await context.Channel.SendMessageAsync($"error: {result}");
}
}
}

View File

@ -23,5 +23,7 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Entities
public virtual ulong LastOnline { get; set; }
public virtual bool HasRename { get; set; }
public virtual ulong RenameCooldown { get; set; }
}
public virtual ulong DiscordId { get; set; }
public virtual string DiscordTag { get; set; }
}
}

View File

@ -12,6 +12,8 @@ namespace DiIiS_NA.Core.Storage.AccountDataBase.Mapper
Table("accounts");
Id(e => e.Id).CustomType<PostgresUserTypeNullable>().GeneratedBy.Sequence("accounts_seq").UnsavedValue(null);
Map(e => e.Email);
Map(e => e.DiscordTag);
Map(e => e.DiscordId).CustomType<PostgresUserType>().Default("0");
Map(e => e.Banned).Not.Nullable().Default("false");
Map(e => e.Salt)/*.CustomSqlType("VarBinary(32)")*/.Length(32);
Map(e => e.PasswordVerifier)/*.CustomSqlType("VarBinary")*/.Length(128);

View File

@ -1,28 +1,28 @@
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Extensions;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.GameSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Act;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Connection;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Game;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Misc;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Portal;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.LoginServer.Toons;
//Blizzless Project 2022
//Blizzless Project 2022
using System;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Linq;
namespace DiIiS_NA.GameServer.ClientSystem
@ -92,7 +92,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
}*/
// Set references between MooNetClient and GameClient.
if (//Mooege.Net.MooNet.Config.Instance.Enabled &&
if (//Mooege.Net.MooNet.Config.Instance.Enabled &&
toon.GameAccount.LoggedInClient != null)
{
client.BnetClient = toon.GameAccount.LoggedInClient;
@ -134,10 +134,14 @@ namespace DiIiS_NA.GameServer.ClientSystem
});
if (client.Player.PlayerIndex > 0)
{
//make sure toons Difficulty is set
toon.CurrentDifficulty = (uint)game.Difficulty;
client.SendMessage(new HandicapMessage(Opcodes.HandicapMessage)
{
Difficulty = (uint)game.Difficulty
});
}
toon.LoginTime = DateTimeExtensions.ToUnixTime(DateTime.UtcNow);
@ -145,7 +149,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
game.Enter(client.Player);
}
}

View File

@ -1,4 +1,5 @@
//Blizzless Project 2022
using DiIiS_NA.Core.Discord;
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
using DiIiS_NA.GameServer.ClientSystem.Base;
@ -24,7 +25,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
public static GSBackend GSBackend { get; set; }
public static int MaintenanceTime = -1;
public Bot DiscordBot { get; set; }
public GameServer()
{
this.OnConnect += ClientManager.Instance.OnConnect;

View File

@ -1,15 +1,15 @@
//Blizzless Project 2022
//Blizzless Project 2022
using System;
using System.Collections.Generic;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Linq;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.MapSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.TagMap;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
@ -70,6 +70,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
return;
}
//if banner has been disabled for events like active greater active swarm /advocaite
if(!player.Attributes[GameAttributeB.Banner_Usable])
{
return;
}
player.ShowConfirmation(this.DynamicID(player), (() => {
player.StartCasting(150, new Action(() => {
if (banner_player.PlayerDirectBanner == null)

View File

@ -1,60 +1,60 @@
//Blizzless Project 2022
//Blizzless Project 2022
using System;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Collections.Generic;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Linq;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Threading.Tasks;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Helpers.Math;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.MPQ;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.MPQ.FileFormats;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.SNO;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ItemsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Inventory;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.ACD;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Artisan;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Misc;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ObjectsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Fields;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Effect;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.ClientSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Base;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PowerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.Math;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Conversation;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Collections.Concurrent;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Platinum;
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
@ -399,8 +399,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
Field1 = 0
});
//RiftEndScreenInfoBlobMessage - 524
plr.InGameClient.SendMessage(new GenericBlobMessage(Opcodes.RiftEndScreenInfoBlobMessage)
{
Data = D3.GameMessage.RiftEndScreenInfo.CreateBuilder()
@ -414,7 +414,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
.SetCompletionTimeMs(900 * 1000 - plr.InGameClient.Game.LastTieredRiftTimeout * 1000)
.SetBannerConfiguration(plr.Toon.GameAccount.BannerConfigurationField.Value)
.Build().ToByteArray()
});
player.InGameClient.SendMessage(new PlatinumAwardedMessage
@ -470,10 +470,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
player.GrantCriteria(74987250579270);
if(player.InGameClient.Game.Difficulty >= 3)
player.GrantCriteria(74987247265988);
player.GrantCriteria(74987247265988);
}
}
//Таймер до закрытия
//Таймер до закрытия
/*
plr.InGameClient.SendMessage(new DungeonFinderClosingMessage()
{
@ -499,7 +499,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.player.InGameClient.Game.ActiveNephalemPortal = false;
this.player.InGameClient.Game.ActiveNephalemTimer = false;
this.player.InGameClient.Game.ActiveNephalemProgress = 0;
//Enabled banner /advocaite
this.player.Attributes[GameAttributeB.Banner_Usable] = true;
var HubWorld = this.player.InGameClient.Game.GetWorld(WorldSno.x1_tristram_adventure_mode_hub);
var NStone = HubWorld.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b);
bool Activated = true;
@ -582,11 +583,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
Gender = (player.Toon.Gender == 0) ? VoiceGender.Male : VoiceGender.Female,
TextClass = currentLineNode.LineSpeaker == Speaker.Player ? (GameBalance.Class)player.Toon.VoiceClassID : GameBalance.Class.None,
SNOSpeakerActor = (int)GetSpeaker(currentLineNode.LineSpeaker).SNO,
LineFlags = 0x00000000,
LineFlags = 0x00000000,
AnimationTag = currentLineNode.AnimationTag,
Duration = duration,
Id = currentUniqueLineID,
Priority = 0x00000000
Priority = 0x00000000
},
Duration = duration,
});//, true);
@ -650,7 +651,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
case 198199:
//Task.Delay(1000).Wait();
break;
}
#endregion
@ -740,7 +741,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
var LeoricGhost = player.World.GetActorBySNO(ActorSno._skeletonking_leoricghost);
var LachdananGhost = player.World.GetActorBySNO(ActorSno._ghostknight3);
var SwordPlace = player.World.GetActorBySNO(ActorSno._trdun_crypt_deathoftheking_sword_clickable);
LachdananGhost.Move(SwordPlace.Position, ActorSystem.Movement.MovementHelpers.GetFacingAngle(LachdananGhost, SwordPlace.Position));
var ListenerA1Q4Event1 = Task.Delay(4000).ContinueWith(delegate

View File

@ -1,121 +1,121 @@
//Blizzless Project 2022
//Blizzless Project 2022
using System;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Collections.Generic;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Linq;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.LoginServer.Toons;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.ClientSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ObjectsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using GameBalance = DiIiS_NA.Core.MPQ.FileFormats.GameBalance;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Storage;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.MapSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Threading;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Storage.AccountDataBase.Entities;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Extensions;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.Math;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Fields;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.ACD;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Text;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Player;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Skill;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Misc;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.MPQ;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.SNO;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Base;
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Effect;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Effect;
//Blizzless Project 2022
using DiIiS_NA.LoginServer.AccountsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Drawing;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.TickerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.SkillsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.TagMap;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PowerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.AISystem.Brains;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ItemsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Fields.BlizzLess.Net.GS.Message.Fields;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.GameSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using Google.ProtocolBuffers;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Animation;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Waypoint;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Trade;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Inventory;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Helpers.Math;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Connection;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Artisan;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Portal;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Camera;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Pet;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Game;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Combat;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Hireling;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Helpers.Hash;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Encounter;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.UI;
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
@ -412,6 +412,11 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
else
this.Attributes[GameAttribute.TeamID] = 2;
//make sure if greater is not active enable banner.
if (!this.World.Game.NephalemGreater)
{
this.Attributes[GameAttributeB.Banner_Usable] = true;
}
SetAllStatsInCorrectOrder();
// Enabled stone of recall
if (!this.World.Game.PvP & this.Toon.StoneOfPortal)
@ -467,7 +472,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
Attributes[GameAttribute.Buff_Icon_Count0, 0x0006B48E] = 1;
Attributes[GameAttribute.Buff_Icon_Count0, 0x0004601B] = 1;
Attributes[GameAttribute.Buff_Icon_Count0, 0x00033C40] = 1;
Attributes[GameAttribute.Currencies_Discovered] = 0x0011FFF8;
this.Attributes[GameAttribute.Skill, 30592] = 1;
@ -1256,7 +1261,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
break;
}
SetAttributesSkillSets(); //reapply synergy passives (laws, mantras, summons)
SetAttributesSkillSets(); //reapply synergy passives (laws, mantras, summons)
}
public void SetAttributesSkillSets()
@ -1567,7 +1572,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
//Type - 0 - Новое свойство
//Type - 1 - Преобразование
//Type - 2 -
//Type - 2 -
if (ItemPortalToCows != null)
{
@ -1650,7 +1655,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
NewTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Зона
NewTagMap.Add(new TagKeySNO(526851), new TagMapEntry(526851, 172, 0)); //Точка входа
this.InGameClient.Game.WorldOfPortalNephalem = map;
while (true)
{
map = Maps[RandomHelper.Next(0, Maps.Length)];
@ -1822,7 +1827,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.InGameClient.Game.ActiveNephalemPortal = true;
this.InGameClient.Game.NephalemGreater = true;
//disable banner while greater is active enable once boss is killed or portal is closed /advocaite
this.Attributes[GameAttributeB.Banner_Usable] = false;
map = Maps[RandomHelper.Next(0, Maps.Length)];
NewTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, (int)map, 0)); //Мир
NewTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 288482, 0)); //Зона
@ -1971,7 +1977,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
private void OnTutorialShown(GameClient client, TutorialShownMessage message)
{
// Server has to save what tutorials are shown, so the player
// does not have to see them over and over...
int index = ItemGenerator.Tutorials.IndexOf(message.SNOTutorial);
@ -2143,7 +2149,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.World.BuffManager.AddBuff(this, this, new PowerSystem.Implementations.P6_Necro_Frailty_Aura());
else
this.World.BuffManager.RemoveBuffs(this, 473992);
//_StartSkillCooldown((cooldownskill as ActiveSkillSavedData).snoSkill, SkillChangeCooldownLength);
}
@ -2187,7 +2193,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.SetAttributesByPassives();
this.SetAttributesByParagon();
this.SetAttributesSkillSets();
this.Inventory.CheckWeapons(); //Handles removal of Heavenly Strength
this.Inventory.CheckWeapons(); //Handles removal of Heavenly Strength
this.Attributes.BroadcastChangedIfRevealed();
this.UpdateHeroState();
UpdatePercentageHP(PercHPbeforeChange);
@ -2277,14 +2283,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
#if DEBUG
Logger.Warn("OnTargetedActor ID: {0}, Name: {1}, NumInWorld: {2}", actor.SNO, actor.Name, actor.NumberInWorld);
#else
#endif
if ((actor.GBHandle.Type == 1) && (actor.Attributes[GameAttribute.TeamID] == 10))
{
this.ExpBonusData.MonsterAttacked(this.InGameClient.Game.TickCounter);
}
actor.OnTargeted(this, message);
}
@ -2308,8 +2314,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
this.Attributes.BroadcastChangedIfRevealed();
var a = this.GetActorsInRange(15f);
#region
#region
//UpdateExp(5000000);
/*
this.Attributes[GameAttribute.Jewel_Upgrades_Max] = 3;
@ -2709,7 +2715,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
int AnimByLevel = 0;
int IdleByLevel = 0;
if (this.ArtisanInteraction == "Blacksmith")
{
if (blacksmith_data.Level > 55) return;
@ -2773,8 +2779,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
client.SendMessage(new CrafterLevelUpMessage
{
Type = 0,
AnimTag = AnimByLevel,
NewIdle = IdleByLevel,
AnimTag = AnimByLevel,
NewIdle = IdleByLevel,
Level = blacksmith_data.Level
});
@ -2814,7 +2820,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.GrantCriteria(74987245845978);
}
if (jeweler_data.Level == 12)
{
{
this.GrantAchievement(74987257153995);
if (blacksmith_data.Level == 12 && mystic_data.Level == 12)
{
@ -2911,7 +2917,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
this.LoadCrafterData();
/**/
}
public void UnlockTransmog(int transmogGBID)
@ -3141,7 +3147,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
ActiveSkeletons = switchertobool;
EnableGolem = switchertoboolTwo;
PowerContext Killer = new PowerContext();
Killer.User = this;
@ -3319,7 +3325,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
int Rune_C = this.Attributes[GameAttribute.Rune_C, PowerSNO];
int Rune_D = this.Attributes[GameAttribute.Rune_D, PowerSNO];
int Rune_E = this.Attributes[GameAttribute.Rune_E, PowerSNO];
if (Rune_A > 0) return runeA;
else if (Rune_B > 0) return runeB;
else if (Rune_C > 0) return runeC;
@ -3396,7 +3402,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
(actor as Portal).Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
(actor as Portal).Destination.StartingPointActorTag = 483;
}
if (actor.ActorType != ActorType.ClientEffect && actor.ActorType != ActorType.AxeSymbol && actor.ActorType != ActorType.CustomBrain)
{
actor.Reveal(this);
@ -3407,7 +3413,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
{
if ((actor is Player && (!this.World.IsPvP || actor == this)) || actors_around.Contains(actor)) // if the actors is already revealed, skip it.
continue;
actor.Unreveal(this);
}
}
@ -3470,14 +3476,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
public override void OnEnter(World world)
{
world.Reveal(this);
this.Unreveal(this);
if (this._CurrentHPValue == -1f)
this.DefaultQueryProximityRadius = 60;
this.InGameClient.SendMessage(new EnterWorldMessage()
{
EnterPosition = this.Position,
@ -3687,7 +3693,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
}
this.World.Game.QuestManager.SetBountyMarker(this);
//System.Threading.Tasks.Task.Delay(1000).ContinueWith(a => {this.BetweenWorlds = false;});
}
@ -4033,7 +4039,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
private PlayerSavedData GetSavedData()
{
var item = StringHashHelper.HashItemName("HealthPotionBottomless");
return new PlayerSavedData()
{
HotBarButtons = this.SkillSet.HotBarSkills,
@ -4060,7 +4066,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
ActiveSkills = this.SkillSet.ActiveSkills,
snoTraits = this.SkillSet.PassiveSkills,
GBIDLegendaryPowers = new int[4] { -1, -1, -1, -1 },
SavePointData = new SavePointData { snoWorld = -1, SavepointId = -1, },
EventFlags = 0
};
@ -4325,7 +4331,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
Logger.Trace("Learning recipe #{0}, Artisan type: {1}", recipe, artisan);
/*var query = this.World.Game.GameDBSession.SessionQuerySingle<DBCraft>(
dbi =>
dbi.DBGameAccount.Id == this.Toon.GameAccount.PersistentID &&
dbi.DBGameAccount.Id == this.Toon.GameAccount.PersistentID &&
dbi.Artisan == artisan &&
dbi.isHardcore == this.World.Game.IsHardcore);*/
if (artisan == "Blacksmith")
@ -4399,7 +4405,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
.SetLevel(this.InGameClient.Game.CurrentAct == 3000 ? this.MysticUnlocked == false && mystic_data.Level < 1 ? 1 : mystic_data.Level : mystic_data.Level)
.SetCooldownEnd(0)
.Build();
D3.ItemCrafting.CrafterSavedData transmog = D3.ItemCrafting.CrafterSavedData.CreateBuilder()
.SetTransmogData(D3.GameBalance.BitPackedGbidArray.CreateBuilder().SetBitfield(ByteString.CopyFrom(mystic_data.LearnedRecipes)))
//.AddRangeUnlockedTransmogs(this.UnserializeBytes(mystic_data.LearnedRecipes))
@ -4408,10 +4414,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
if (this.BlacksmithUnlocked || this.InGameClient.Game.CurrentAct == 3000)
this.InGameClient.SendMessage(new GenericBlobMessage(Opcodes.CraftingDataBlacksmithInitialMessage) { Data = blacksmith.ToByteArray() });
if (this.JewelerUnlocked || this.InGameClient.Game.CurrentAct == 3000)
this.InGameClient.SendMessage(new GenericBlobMessage(Opcodes.CraftingDataJewelerInitialMessage) { Data = jeweler.ToByteArray() });
if (this.MysticUnlocked || this.InGameClient.Game.CurrentAct == 3000)
{
this.InGameClient.SendMessage(new GenericBlobMessage(Opcodes.CraftingDataMysticInitialMessage) { Data = mystic.ToByteArray() });
@ -4430,7 +4436,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.Inventory.UpdateCurrencies();
}
public void LoadMailData()
{
List<DBMail> mail_data = this.World.Game.GameDBSession.SessionQueryWhere<DBMail>(dbm => dbm.DBToon.Id == this.Toon.PersistentID && dbm.Claimed == false);
@ -4539,7 +4545,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
this.Inventory.UpdateCurrencies();
}
ClientSystem.GameServer.GSBackend.GrantAchievement(this.Toon.GameAccount.PersistentID, id);
}
catch (Exception e)
{
@ -5087,7 +5093,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
PlayerIndex = this.PlayerIndex,
Level = this.Level
});
//Test Update Monster Level
if (this.PlayerIndex == 0)
@ -5337,7 +5343,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
else if (item.ItemDefinition.Name == "Platinum")
{
this.InGameClient.SendMessage(new FloatingAmountMessage()
{
Place = new WorldPlace()
@ -5486,7 +5492,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
});
}
plr.InGameClient.SendMessage(new PlayMusicMessage(Opcodes.PlayMusicMessage)
{
SNO = 0x0005BBD8
@ -5818,7 +5824,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
GeneratePrimaryResource(Math.Max(tickSeconds * this.Attributes[GameAttribute.Resource_Regen_Total, this.Attributes[GameAttribute.Resource_Type_Primary] - 1], 0));
GenerateSecondaryResource(Math.Max(tickSeconds * this.Attributes[GameAttribute.Resource_Regen_Total, this.Attributes[GameAttribute.Resource_Type_Secondary] - 1], 0));
float totalHPregen = //(this.Attributes[GameAttribute.Hitpoints_Regen_Per_Second] +
float totalHPregen = //(this.Attributes[GameAttribute.Hitpoints_Regen_Per_Second] +
this.Attributes[GameAttribute.Hitpoints_Regen_Per_Second_Bonus]//)
* (1 + this.Attributes[GameAttribute.Hitpoints_Regen_Bonus_Percent]);
if (!this.Dead && !this.World.Game.PvP) AddHP(Math.Max(tickSeconds * totalHPregen, 0));
@ -5923,7 +5929,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
minion.Attributes[GameAttribute.Pet_Creator] = 1;
minion.Attributes[GameAttribute.Pet_Owner] = 1;
minion.Attributes[GameAttribute.Pet_Type] = 25;
//*/
minion.Attributes[GameAttribute.Effect_Owner_ANN] = (int)this.DynamicID(this);
minion.EnterWorld(minion.Position);

View File

@ -1,60 +1,60 @@
//Blizzless Project 2022
//Blizzless Project 2022
using System;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Collections.Generic;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Linq;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Text;
//Blizzless Project 2022
//Blizzless Project 2022
using System.Threading.Tasks;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Misc;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Animation;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Effect;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Combat;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Helpers.Math;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.LoginServer.Toons;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.Core.Types.TagMap;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.GeneratorsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ItemsSystem;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Player;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.ACD;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Base;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Text;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Quest;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Definitions.World;
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.GameServer.MessageSystem.Message.Fields;
using DiIiS_NA.D3_GameServer.Core.Types.SNO;
@ -199,7 +199,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (this.Target is Monster)
{
Monster mon = (Monster)this.Target;
if (mon.Brain != null)
mon.Brain.Kill();
@ -246,7 +246,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
ActorId = this.Target.DynamicID(plr),
Effect = Effect.Unknown12,
}, this.Target);
this.Target.World.BroadcastIfRevealed(plr => new ANNDataMessage(Opcodes.PlayIdleAnimationMessage)
{
ActorID = this.Target.DynamicID(plr)
@ -281,7 +281,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
}
break;
}
this.Target.World.BroadcastIfRevealed(plr => new ANNDataMessage(Opcodes.CancelACDTargetMessage)
{
ActorID = this.Target.DynamicID(plr),
@ -295,7 +295,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
this.Target.Attributes[GameAttribute.Deleted_On_Server] = true;
this.Target.Attributes[GameAttribute.Could_Have_Ragdolled] = true;
this.Target.Attributes.BroadcastChangedIfRevealed();
this.Target.World.BroadcastIfRevealed(plr => new DeathFadeTimeMessage()
{
Field0 = this.Target.DynamicID(plr),
@ -303,7 +303,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
Field2 = 200,
Field3 = true
}, this.Target);
if (this.Context != null)
if (this.Context.User.Attributes[GameAttribute.Item_Power_Passive, 247640] == 1 ||
this.Context.User.Attributes[GameAttribute.Item_Power_Passive, 249963] == 1 ||
@ -334,7 +334,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
//(this.Context.User as Player).Attributes[_Buff_Icon_End_TickN, PowerSNO]
}
}
if (this.Target.SNO == ActorSno._a4dun_garden_corruption_monster) //Сады надежды
{
@ -569,7 +569,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
}
Logger.Trace("Killed monster, id: {0}, level {1}", this.Target.SNO, this.Target.Attributes[GameAttribute.Level]);
//handling quest triggers
if (this.Target.World.Game.QuestProgress.QuestTriggers.ContainsKey((int)this.Target.SNO))
{
@ -613,9 +613,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
{
if (plr.PlayerIndex == 0)
Master = plr;
plr.InGameClient.SendMessage(new SimpleMessage(Opcodes.KillCounterRefresh)
plr.InGameClient.SendMessage(new SimpleMessage(Opcodes.KillCounterRefresh)
{
});
plr.InGameClient.SendMessage(new FloatDataMessage(Opcodes.DungeonFinderProgressMessage)
@ -623,7 +623,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
Field0 = this.Target.World.Game.ActiveNephalemProgress
});
if (this.Target.World.Game.ActiveNephalemProgress > 650)
{
@ -710,7 +710,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
this.Target.World.Game.ActiveNephalemKilledBoss = true;
foreach (var plr in this.Target.World.Game.Players.Values)
{
//Enable banner /advocaite
plr.Attributes[GameAttributeB.Banner_Usable] = true;
if (this.Target.World.Game.NephalemGreater)
{
plr.InGameClient.SendMessage(new QuestCounterMessage()
@ -762,7 +763,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
NewTagMap.Add(new TagKeySNO(526850), new TagMapEntry(526850, 332336, 0)); //Мир
NewTagMap.Add(new TagKeySNO(526853), new TagMapEntry(526853, 332339, 0)); //Зона
NewTagMap.Add(new TagKeySNO(526851), new TagMapEntry(526851, 24, 0)); //Точка входа
var portal = new Portal(this.Target.World, ActorSno._x1_openworld_lootrunportal, NewTagMap);
portal.EnterWorld(new Core.Types.Math.Vector3D(this.Target.Position.X + 10f, this.Target.Position.Y + 10f, this.Target.Position.Z));
@ -1007,8 +1008,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
//114917
if (this.Target.Quality == 7 || this.Target.Quality == 2 || this.Target.Quality == 4)
{
{
}
if (this.Target is Boss)
@ -1146,7 +1147,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
{
var tomb = new Headstone(this.Target.World, ActorSno._playerheadstone, new TagMap(), player.PlayerIndex);
tomb.EnterWorld(player.Position);
player.Inventory.DecreaseDurability(0.1f);
if (player.World.Game.IsHardcore)
{

View File

@ -1,5 +1,6 @@
//Blizzless Project 2022
//Blizzless Project 2022
using DiIiS_NA.Core.Discord.Modules;
using DiIiS_NA.Core.Logging;
//Blizzless Project 2022
using DiIiS_NA.Core.MPQ;
@ -165,6 +166,7 @@ namespace DiIiS_NA
Logger.Info("REST server started - " + REST.Config.Instance.IP + ":{0}", REST.Config.Instance.PORT);
}
//BGS
ServerBootstrap b = new ServerBootstrap();
IEventLoopGroup boss = new MultithreadEventLoopGroup(1);
@ -269,7 +271,16 @@ namespace DiIiS_NA
GameServer = new DiIiS_NA.GameServer.ClientSystem.GameServer();
GameServerThread = new Thread(GameServer.Run) { Name = "GameServerThread", IsBackground = true };
GameServerThread.Start();
if (DiIiS_NA.Core.Discord.Config.Instance.Enabled)
{
Logger.Info("Starting Discord bot handler..");
GameServer.DiscordBot = new Core.Discord.Bot();
GameServer.DiscordBot.MainAsync().GetAwaiter().GetResult();
}
else
{
Logger.Info("Discord bot Disabled..");
}
DiIiS_NA.GameServer.GSSystem.GeneratorsSystem.SpawnGenerator.RegenerateDensity();
DiIiS_NA.GameServer.ClientSystem.GameServer.GSBackend = new GSBackend(DiIiS_NA.LoginServer.Config.Instance.BindIP, DiIiS_NA.LoginServer.Config.Instance.WebPort);
return true;

153
src/DiIiS-NA/config.ini Normal file
View File

@ -0,0 +1,153 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; blizzless Configuration File ;
; ;
;-----------------------------------------------------------------------------------------------------------------;
; ;
; This file is an example configuration and may require modification to suit your needs. ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Settings for Bnet
[Battle-Server]
Enabled = true
BindIP = 127.0.0.1
WebPort = 9800
Port = 1119
BindIPv6 = ::1
MOTD = Welcome to Diablo 3!
[IWServer]
IWServer = false
; Settings for REST
[REST]
IP = 127.0.0.1
Public = true
PublicIP = 127.0.0.1
PORT = 8081
; Settings for game
[Game-Server]
Enabled = true
CoreActive = true
BindIP = 127.0.0.1
WebPort = 9100
Port = 2001
BindIPv6 = ::1
DRLGemu = true
;Modding of game
RateExp = 1
RateMoney = 1
RateDrop = 1
RateChangeDrop = 1
RateMonsterHP = 1
RateMonsterDMG = 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Authentication settings
[Authentication]
DisablePasswordChecks=true
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Discord bot settings
[Discord]
Enabled=true
MonitorEnabled=false
Token=sectret token
GuildId=0
AnnounceChannelId=0
StatsChannelId=0
EventsChannelId=0
BaseRoleId=0
PremiumRoleId=0
CollectorRoleId=0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; You can set here the command-prefix. Note: You can't use slash as a prefix.
[Commands]
CommandPrefix = !
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Networking settings.
[Networking]
EnableIPv6 = false ; experimental!!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Network address translation settings.
; You only need to change this if you're running behind a dsl router or so.
; Important: If you enable NAT, LAN-clients will not able to connect in gs.
; (Will be fixed later with a proper implementation similar to one in pvpgn).
[NAT]
Enabled = false
PublicIP = 101.185.137.121 ; You need to change this to your router's public interface IP if you'd like to use NAT.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; General logging settings
[Logging]
Root=logs
; Settings for console logger
[ConsoleLog]
Enabled=true
Target=Console
IncludeTimeStamps=true
MinimumLevel=Trace
MaximumLevel=Fatal
; Settings for server log file.
[ServerLog]
Enabled=true
Target=File
FileName="blizzless.log"
IncludeTimeStamps=true
MinimumLevel=Trace
MaximumLevel=Fatal
ResetOnStartup=true
; Settings for chat log file.
[ChatLog]
Enabled=true
Target=File
FileName="blizzless-chat.log"
IncludeTimeStamps=true
MinimumLevel=ChatMessage
MaximumLevel=ChatMessage
ResetOnStartup=true
; Settings for discord log file.
[DiscordLog]
Enabled=false
Target=File
FileName="discord-bot.log"
IncludeTimeStamps=true
MinimumLevel=BotCommand
MaximumLevel=BotCommand
ResetOnStartup=true
; Settings for renames log file.
[RenameAccountLog]
Enabled=true
Target=File
FileName="blizzless-btag-rename.log"
IncludeTimeStamps=true
MinimumLevel=RenameAccountLog
MaximumLevel=RenameAccountLog
ResetOnStartup=true
; Settings for packet logger, only recommended for developers!
[PacketLog]
Enabled=true
Target=File
FileName="packet-dump.log"
IncludeTimeStamps=true
MinimumLevel=PacketDump
MaximumLevel=PacketDump
ResetOnStartup=true

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Configurations>Debug;Release;github</Configurations>
</PropertyGroup>
<ItemGroup>