Merge pull request #85 from iamdroppy/translation

Translation & Static Refactoring
This commit is contained in:
pr701 2023-01-22 18:33:08 +03:00 committed by GitHub
commit 06a5dcdf01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
281 changed files with 9968 additions and 9813 deletions

View File

@ -43,7 +43,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
var val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 2, 0, this.LastSelectedGameAccount); var val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 2, 0, LastSelectedGameAccount);
return val; return val;
} }
} }
@ -53,8 +53,8 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
ByteStringPresenceField<D3.OnlineService.EntityId> val = null; ByteStringPresenceField<D3.OnlineService.EntityId> val = null;
if (this.GameAccount.CurrentToon != null) if (GameAccount.CurrentToon != null)
val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 1, 0, this.GameAccount.CurrentToon.D3EntityID); val = new ByteStringPresenceField<D3.OnlineService.EntityId>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.Account, 1, 0, GameAccount.CurrentToon.D3EntityID);
else else
{ {
var Fake = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0); var Fake = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0);
@ -77,7 +77,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
var val = new BoolPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 2, 0, this.IsOnline); var val = new BoolPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 2, 0, IsOnline);
return val; return val;
} }
} }
@ -86,7 +86,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
var val = new StringPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 4, 0, this.BattleTagName + "#" + HashCode.ToString("D4")); var val = new StringPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 4, 0, BattleTagName + "#" + HashCode.ToString("D4"));
return val; return val;
} }
} }
@ -95,7 +95,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
var val = new StringPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 2, 0, this.BroadcastMessage); var val = new StringPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 2, 0, BroadcastMessage);
return val; return val;
} }
} }
@ -105,7 +105,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
var val = new EntityIdPresenceFieldList(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 3, 0); var val = new EntityIdPresenceFieldList(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 3, 0);
val.Value.Add(this.GameAccount.BnetEntityId); val.Value.Add(GameAccount.BnetEntityId);
return val; return val;
} }
} }
@ -117,15 +117,15 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
var val = new IntPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 6, 0, 0); var val = new IntPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.Account, 6, 0, 0);
val.Value = (long)this.LastOnline; val.Value = (long)LastOnline;
return val; return val;
} }
set set
{ {
this.LastOnline = (ulong)value.Value; LastOnline = (ulong)value.Value;
this.DBAccount.LastOnline = (ulong)value.Value; DBAccount.LastOnline = (ulong)value.Value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} }
@ -152,7 +152,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBAccount.Email; return DBAccount.Email;
} }
private set private set
{ {
@ -160,34 +160,34 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
public string SaltedTicket public string SaltedTicket
{ {
get { return this.DBAccount.SaltedTicket; } get { return DBAccount.SaltedTicket; }
internal set internal set
{ {
this.DBAccount.SaltedTicket = value; DBAccount.SaltedTicket = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} }
public byte[] Salt public byte[] Salt
{ {
get { return this.DBAccount.Salt.ToArray(); } get { return DBAccount.Salt.ToArray(); }
internal set internal set
{ {
this.DBAccount.Salt = value; DBAccount.Salt = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} // s- User's salt. } // s- User's salt.
public byte[] FullSalt public byte[] FullSalt
{ {
get { return this.DBAccount.Salt.ToArray(); } get { return DBAccount.Salt.ToArray(); }
} // s- User's salt. } // s- User's salt.
public byte[] PasswordVerifier public byte[] PasswordVerifier
{ {
get { return this.DBAccount.PasswordVerifier; } get { return DBAccount.PasswordVerifier; }
internal set internal set
{ {
this.DBAccount.PasswordVerifier = value; DBAccount.PasswordVerifier = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} // v - password verifier. } // v - password verifier.
@ -195,12 +195,12 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBAccount.HashCode; return DBAccount.HashCode;
} }
private set private set
{ {
this.DBAccount.HashCode = value; DBAccount.HashCode = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} }
@ -208,21 +208,21 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
bool staff = (this.DBAccount.UserLevel > Account.UserLevels.Tester); bool staff = (DBAccount.UserLevel > UserLevels.Tester);
//(controller as HandlerController).Client.Account.GameAccount.ProgramField.Value //(controller as HandlerController).Client.Account.GameAccount.ProgramField.Value
if(this.GameAccount.ProgramField.Value == "APP") if(GameAccount.ProgramField.Value == "APP")
return string.Format("{0}", this.DBAccount.BattleTagName); return string.Format("{0}", DBAccount.BattleTagName);
else if (this.GameAccount.ProgramField.Value == "D3") else if (GameAccount.ProgramField.Value == "D3")
return string.Format("{0}", this.DBAccount.BattleTagName); return string.Format("{0}", DBAccount.BattleTagName);
//return string.Format(staff ? " {{icon:bnet}} {{c_legendary}}{0}{{/c}}" : ("{0}"), this.DBAccount.BattleTagName); //return string.Format(staff ? " {{icon:bnet}} {{c_legendary}}{0}{{/c}}" : ("{0}"), this.DBAccount.BattleTagName);
else else
return string.Format("{0}", this.DBAccount.BattleTagName); return string.Format("{0}", DBAccount.BattleTagName);
//return (staff ? " {icon:bnet} " : (premium ? " {icon:gold} " : "")) + dbAcc.BattleTagName; //return (staff ? " {icon:bnet} " : (premium ? " {icon:gold} " : "")) + dbAcc.BattleTagName;
} //{c_blue}{/c} } //{c_blue}{/c}
private set private set
{ {
this.DBAccount.BattleTagName = value; DBAccount.BattleTagName = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} }
@ -230,7 +230,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.BattleTagName + "#" + this.HashCode.ToString("D4"); return BattleTagName + "#" + HashCode.ToString("D4");
} }
set set
{ {
@ -238,19 +238,19 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
throw new Exception("BattleTag must contain '#'"); throw new Exception("BattleTag must contain '#'");
var split = value.Split('#'); var split = value.Split('#');
this.DBAccount.BattleTagName = split[0]; DBAccount.BattleTagName = split[0];
this.DBAccount.HashCode = Convert.ToInt32(split[1]); DBAccount.HashCode = Convert.ToInt32(split[1]);
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} }
public UserLevels UserLevel public UserLevels UserLevel
{ {
get { return this.DBAccount.UserLevel; } get { return DBAccount.UserLevel; }
internal set internal set
{ {
this.DBAccount.UserLevel = value; DBAccount.UserLevel = value;
DBSessions.SessionUpdate(this.DBAccount); DBSessions.SessionUpdate(DBAccount);
} }
} // user level for account. } // user level for account.
@ -263,16 +263,16 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this.CurrentGameAccountId == 0) return null; if (CurrentGameAccountId == 0) return null;
if (this._currentGameAccount == null) if (_currentGameAccount == null)
this._currentGameAccount = GameAccountManager.GetAccountByPersistentID(this.CurrentGameAccountId); _currentGameAccount = GameAccountManager.GetAccountByPersistentID(CurrentGameAccountId);
return this._currentGameAccount; return _currentGameAccount;
} }
set set
{ {
this._currentGameAccount = value; _currentGameAccount = value;
this.CurrentGameAccountId = value.PersistentID; CurrentGameAccountId = value.PersistentID;
} }
} }
@ -283,7 +283,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.GameAccount.D3GameAccountId; return GameAccount.D3GameAccountId;
} }
} }
@ -292,18 +292,18 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
public Account(DBAccount dbAccount) public Account(DBAccount dbAccount)
: base(dbAccount.Id) : base(dbAccount.Id)
{ {
this.DBAccount = dbAccount; DBAccount = dbAccount;
var account_relations = DBSessions.SessionQueryWhere<DBAccountLists>(dbl => dbl.ListOwner.Id == this.PersistentID); var account_relations = DBSessions.SessionQueryWhere<DBAccountLists>(dbl => dbl.ListOwner.Id == PersistentID);
this.FriendsIds = new HashSet<ulong>(account_relations.Where(dbl => dbl.Type == "FRIEND").Select(a => a.ListTarget.Id)).ToList(); FriendsIds = new HashSet<ulong>(account_relations.Where(dbl => dbl.Type == "FRIEND").Select(a => a.ListTarget.Id)).ToList();
this.IgnoreIds = new HashSet<ulong>(account_relations.Where(dbl => dbl.Type == "IGNORE").Select(a => a.ListTarget.Id)).ToList(); IgnoreIds = new HashSet<ulong>(account_relations.Where(dbl => dbl.Type == "IGNORE").Select(a => a.ListTarget.Id)).ToList();
this.LastOnline = dbAccount.LastOnline; LastOnline = dbAccount.LastOnline;
SetFields(); SetFields();
} }
private void SetFields() private void SetFields()
{ {
this.BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.AccountId).SetLow(this.PersistentID).Build(); BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.AccountId).SetLow(PersistentID).Build();
} }
public void Update(IList<FieldOperation> operations) public void Update(IList<FieldOperation> operations)
@ -331,7 +331,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
} }
if (operationsToUpdate.Count > 0) if (operationsToUpdate.Count > 0)
base.UpdateSubscribers(Subscribers, operationsToUpdate); UpdateSubscribers(Subscribers, operationsToUpdate);
} }
private Field.Builder DoSet(Field field) private Field.Builder DoSet(Field field)
@ -339,7 +339,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
FieldOperation.Builder operation = FieldOperation.CreateBuilder(); FieldOperation.Builder operation = FieldOperation.CreateBuilder();
Field.Builder returnField = Field.CreateBuilder().SetKey(field.Key); Field.Builder returnField = Field.CreateBuilder().SetKey(field.Key);
if (this.GameAccount.LoggedInClient == null) return returnField; if (GameAccount.LoggedInClient == null) return returnField;
switch ((FieldKeyHelper.Program)field.Key.Program) switch ((FieldKeyHelper.Program)field.Key.Program)
{ {
@ -352,7 +352,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
if (field.Key.Group == 1 && field.Key.Field == 2) // Account's broadcast message if (field.Key.Group == 1 && field.Key.Field == 2) // Account's broadcast message
{ {
Logger.Trace("{0} set broadcast message to {1}.", this, field.Value.StringValue); Logger.Trace("{0} set broadcast message to {1}.", this, field.Value.StringValue);
this.BroadcastMessage = field.Value.StringValue; BroadcastMessage = field.Value.StringValue;
} }
else if (field.Key.Group == 1 && field.Key.Field == 7) // Account's AFK status else if (field.Key.Group == 1 && field.Key.Field == 7) // Account's AFK status
{ {
@ -392,22 +392,22 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
}*/ }*/
} }
public bgs.protocol.presence.v1.Field QueryField(bgs.protocol.presence.v1.FieldKey queryKey) public Field QueryField(FieldKey queryKey)
{ {
var field = bgs.protocol.presence.v1.Field.CreateBuilder().SetKey(queryKey); var field = Field.CreateBuilder().SetKey(queryKey);
switch ((FieldKeyHelper.Program)queryKey.Program) switch ((FieldKeyHelper.Program)queryKey.Program)
{ {
case FieldKeyHelper.Program.D3: case FieldKeyHelper.Program.D3:
if (queryKey.Group == 1 && queryKey.Field == 1) // Account's last selected toon. if (queryKey.Group == 1 && queryKey.Field == 1) // Account's last selected toon.
{ {
if (this.IsOnline) // check if the account is online actually. if (IsOnline) // check if the account is online actually.
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(this.GameAccount.LastPlayedHeroId.ToByteString()).Build()); field.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(GameAccount.LastPlayedHeroId.ToByteString()).Build());
} }
else if (queryKey.Group == 1 && queryKey.Field == 2) // Account's last selected Game Account else if (queryKey.Group == 1 && queryKey.Field == 2) // Account's last selected Game Account
{ {
if (this.IsOnline) // check if the account is online actually. if (IsOnline) // check if the account is online actually.
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(this.LastSelectedGameAccount.ToByteString()).Build()); field.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(LastSelectedGameAccount.ToByteString()).Build());
} }
else else
{ {
@ -417,11 +417,11 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
case FieldKeyHelper.Program.BNet: case FieldKeyHelper.Program.BNet:
if (queryKey.Group == 1 && queryKey.Field == 4) // Account's battleTag if (queryKey.Group == 1 && queryKey.Field == 4) // Account's battleTag
{ {
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetStringValue(this.BattleTag).Build()); field.SetValue(bgs.protocol.Variant.CreateBuilder().SetStringValue(BattleTag).Build());
} }
else if (queryKey.Group == 1 && queryKey.Field == 2) // Account's broadcast message else if (queryKey.Group == 1 && queryKey.Field == 2) // Account's broadcast message
{ {
field.SetValue(bgs.protocol.Variant.CreateBuilder().SetStringValue(this.BroadcastMessage).Build()); field.SetValue(bgs.protocol.Variant.CreateBuilder().SetStringValue(BroadcastMessage).Build());
} }
else else
{ {
@ -440,7 +440,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
var operations = ChangedFields.GetChangedFieldList(); var operations = ChangedFields.GetChangedFieldList();
ChangedFields.ClearChanged(); ChangedFields.ClearChanged();
base.UpdateSubscribers(this.Subscribers, operations); UpdateSubscribers(Subscribers, operations);
} }
//account class generated //account class generated
@ -450,7 +450,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
//Bnet, Account,3,index -> GameAccount EntityIds //Bnet, Account,3,index -> GameAccount EntityIds
//Bnet, Account,4,0 -> BattleTag //Bnet, Account,4,0 -> BattleTag
public override List<bgs.protocol.presence.v1.FieldOperation> GetSubscriptionNotifications() public override List<FieldOperation> GetSubscriptionNotifications()
{ {
//TODO: Create delegate-move this out //TODO: Create delegate-move this out
/*this.GameAccountListField.Value.Clear(); /*this.GameAccountListField.Value.Clear();
@ -460,20 +460,20 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
}*/ }*/
var operationList = new List<bgs.protocol.presence.v1.FieldOperation>(); var operationList = new List<FieldOperation>();
//if (this.LastSelectedHero != AccountHasNoToons) //if (this.LastSelectedHero != AccountHasNoToons)
//operationList.Add(this.LastPlayedHeroIdField.GetFieldOperation()); //operationList.Add(this.LastPlayedHeroIdField.GetFieldOperation());
if (this.LastSelectedGameAccount != AccountHasNoToons) if (LastSelectedGameAccount != AccountHasNoToons)
{ {
operationList.Add(this.LastPlayedToonIdField.GetFieldOperation()); operationList.Add(LastPlayedToonIdField.GetFieldOperation());
operationList.Add(this.LastPlayedGameAccountIdField.GetFieldOperation()); operationList.Add(LastPlayedGameAccountIdField.GetFieldOperation());
} }
operationList.Add(this.RealIDTagField.GetFieldOperation()); operationList.Add(RealIDTagField.GetFieldOperation());
operationList.Add(this.AccountOnlineField.GetFieldOperation()); operationList.Add(AccountOnlineField.GetFieldOperation());
operationList.AddRange(this.GameAccountListField.GetFieldOperationList()); operationList.AddRange(GameAccountListField.GetFieldOperationList());
operationList.Add(this.AccountBattleTagField.GetFieldOperation()); operationList.Add(AccountBattleTagField.GetFieldOperation());
operationList.Add(this.BroadcastMessageField.GetFieldOperation()); operationList.Add(BroadcastMessageField.GetFieldOperation());
operationList.Add(this.LastOnlineField.GetFieldOperation()); operationList.Add(LastOnlineField.GetFieldOperation());
return operationList; return operationList;
} }
@ -489,13 +489,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
if (password.Length < 8 || password.Length > 16) if (password.Length < 8 || password.Length > 16)
return false; return false;
var calculatedVerifier = SRP6a.CalculatePasswordVerifierForAccount(this.Email, password, this.FullSalt); var calculatedVerifier = SRP6a.CalculatePasswordVerifierForAccount(Email, password, FullSalt);
return calculatedVerifier.SequenceEqual(this.PasswordVerifier); return calculatedVerifier.SequenceEqual(PasswordVerifier);
} }
public override string ToString() public override string ToString()
{ {
return String.Format("{{ Account: {0} [lowId: {1}] }}", this.Email, this.BnetEntityId.Low); return String.Format("{{ Account: {0} [lowId: {1}] }}", Email, BnetEntityId.Low);
} }
/// <summary> /// <summary>

View File

@ -64,9 +64,9 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.DBAccount = value.DBAccount; dbGAcc.DBAccount = value.DBAccount;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -79,16 +79,16 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return DBSessions.SessionGet<DBGameAccount>(this.PersistentID); return DBSessions.SessionGet<DBGameAccount>(PersistentID);
} }
set { } set { }
} }
public D3.OnlineService.EntityId D3GameAccountId public EntityId D3GameAccountId
{ {
get get
{ {
return D3.OnlineService.EntityId.CreateBuilder().SetIdHigh(BnetEntityId.High).SetIdLow(PersistentID).Build(); return EntityId.CreateBuilder().SetIdHigh(BnetEntityId.High).SetIdLow(PersistentID).Build();
} }
} }
@ -117,7 +117,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return new IntPresenceField(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.GameAccount, 3, 0, this.CurrentActivity); return new IntPresenceField(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.GameAccount, 3, 0, CurrentActivity);
} }
} }
@ -126,7 +126,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
var val = new ByteStringPresenceField<D3.Guild.GuildSummary>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.GameAccount, 7, 0); var val = new ByteStringPresenceField<D3.Guild.GuildSummary>(FieldKeyHelper.Program.D3, FieldKeyHelper.OriginatingClass.GameAccount, 7, 0);
val.Value = this.Clan.Summary; val.Value = Clan.Summary;
return val; return val;
} }
} }
@ -144,9 +144,9 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this.CurrentToon == null) if (CurrentToon == null)
return Toons.Count > 0 ? Toons.First().D3EntityID : AccountHasNoToons; return Toons.Count > 0 ? Toons.First().D3EntityID : AccountHasNoToons;
return this.CurrentToon.D3EntityID; return CurrentToon.D3EntityID;
} }
} }
@ -179,11 +179,11 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this.LoggedInClient != null && this.LoggedInClient.CurrentChannel != null) if (LoggedInClient != null && LoggedInClient.CurrentChannel != null)
{ {
return bgs.protocol.channel.v1.ChannelId.CreateBuilder() return bgs.protocol.channel.v1.ChannelId.CreateBuilder()
.SetType(0) .SetType(0)
.SetId((uint)this.LoggedInClient.CurrentChannel.D3EntityId.IdLow) .SetId((uint)LoggedInClient.CurrentChannel.D3EntityId.IdLow)
.SetHost(bgs.protocol.ProcessId.CreateBuilder().SetLabel(1).SetEpoch(0)) .SetHost(bgs.protocol.ProcessId.CreateBuilder().SetLabel(1).SetEpoch(0))
.Build(); .Build();
} }
@ -193,7 +193,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
set set
{ {
if (value != null) if (value != null)
this.LoggedInClient.CurrentChannel = ChannelManager.GetChannelByChannelId (value); LoggedInClient.CurrentChannel = ChannelManager.GetChannelByChannelId (value);
} }
} }
@ -201,9 +201,9 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this.LoggedInClient != null && this.LoggedInClient.CurrentChannel != null) if (LoggedInClient != null && LoggedInClient.CurrentChannel != null)
{ {
return this.LoggedInClient.CurrentChannel.D3EntityId; return LoggedInClient.CurrentChannel.D3EntityId;
} }
else else
return null; return null;
@ -211,7 +211,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
set set
{ {
if (value != null) if (value != null)
this.LoggedInClient.CurrentChannel = ChannelManager.GetChannelByEntityId(value); LoggedInClient.CurrentChannel = ChannelManager.GetChannelByEntityId(value);
} }
} }
@ -250,7 +250,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
var val = new EntityIdPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.GameAccount, 7, 0); var val = new EntityIdPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.GameAccount, 7, 0);
val.Value = this.Owner.BnetEntityId; val.Value = Owner.BnetEntityId;
return val; return val;
} }
} }
@ -274,7 +274,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return new IntPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.GameAccount, 4, 0, (long)this.LastOnline); return new IntPresenceField(FieldKeyHelper.Program.BNet, FieldKeyHelper.OriginatingClass.GameAccount, 4, 0, (long)LastOnline);
} }
} }
@ -287,10 +287,10 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this._bannerConfiguration != null) if (_bannerConfiguration != null)
return this._bannerConfiguration; return _bannerConfiguration;
var res = BannerConfiguration.CreateBuilder(); var res = BannerConfiguration.CreateBuilder();
if (this.DBGameAccount.Banner == null || this.DBGameAccount.Banner.Length < 1) if (DBGameAccount.Banner == null || DBGameAccount.Banner.Length < 1)
{ {
res = BannerConfiguration.CreateBuilder() res = BannerConfiguration.CreateBuilder()
.SetBannerShape(189701627) .SetBannerShape(189701627)
@ -306,25 +306,25 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
//.SetEpicBanner((uint)StringHashHelper.HashNormal("Banner_Epic_03_PVP_Class_Completion")) //.SetEpicBanner((uint)StringHashHelper.HashNormal("Banner_Epic_03_PVP_Class_Completion"))
//.SetEpicBanner((uint)StringHashHelper.HashNormal("Banner_Epic_01_Hardcore")) //.SetEpicBanner((uint)StringHashHelper.HashNormal("Banner_Epic_01_Hardcore"))
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.Banner = res.Build().ToByteArray(); dbGAcc.Banner = res.Build().ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
} }
else else
res = BannerConfiguration.CreateBuilder(BannerConfiguration.ParseFrom(this.DBGameAccount.Banner)); res = BannerConfiguration.CreateBuilder(BannerConfiguration.ParseFrom(DBGameAccount.Banner));
this._bannerConfiguration = res.Build(); _bannerConfiguration = res.Build();
return this._bannerConfiguration; return _bannerConfiguration;
} }
set set
{ {
this._bannerConfiguration = value; _bannerConfiguration = value;
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.Banner = value.ToByteArray(); dbGAcc.Banner = value.ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -356,7 +356,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this.CurrentToon.IsHardcore) if (CurrentToon.IsHardcore)
return "D3_GOLD_HC"; return "D3_GOLD_HC";
else else
return "D3_GOLD"; return "D3_GOLD";
@ -369,16 +369,16 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this._currentToonId == 0) return null; if (_currentToonId == 0) return null;
return ToonManager.GetToonByLowID(this._currentToonId); return ToonManager.GetToonByLowID(_currentToonId);
} }
set set
{ {
if (value.GameAccount.PersistentID != this.PersistentID) return; //just in case... if (value.GameAccount.PersistentID != PersistentID) return; //just in case...
this._currentToonId = value.PersistentID; _currentToonId = value.PersistentID;
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.LastPlayedHero = value.DBToon; dbGAcc.LastPlayedHero = value.DBToon;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -401,13 +401,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBGameAccount.Gold; return DBGameAccount.Gold;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.Gold = value; dbGAcc.Gold = value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -418,13 +418,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBGameAccount.HardcoreGold; return DBGameAccount.HardcoreGold;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.HardcoreGold = value; dbGAcc.HardcoreGold = value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -435,13 +435,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBGameAccount.BloodShards; return DBGameAccount.BloodShards;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.BloodShards = value; dbGAcc.BloodShards = value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -452,13 +452,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBGameAccount.HardcoreBloodShards; return DBGameAccount.HardcoreBloodShards;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.HardcoreBloodShards = value; dbGAcc.HardcoreBloodShards = value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -469,13 +469,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return this.DBGameAccount.TotalBloodShards; return DBGameAccount.TotalBloodShards;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.TotalBloodShards = value; dbGAcc.TotalBloodShards = value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -504,7 +504,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
get get
{ {
GameAccountSettings res = null; GameAccountSettings res = null;
if (this.DBGameAccount.UISettings == null || this.DBGameAccount.UISettings.Length < 1) if (DBGameAccount.UISettings == null || DBGameAccount.UISettings.Length < 1)
{ {
res = GameAccountSettings.CreateBuilder() res = GameAccountSettings.CreateBuilder()
//.SetChatFontSize(8) //.SetChatFontSize(8)
@ -513,23 +513,23 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
.AddAutoJoinChannelsDeprecated("D3_GeneralChat") .AddAutoJoinChannelsDeprecated("D3_GeneralChat")
.Build(); .Build();
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.UISettings = res.ToByteArray(); dbGAcc.UISettings = res.ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
} }
else else
res = GameAccountSettings.ParseFrom(this.DBGameAccount.UISettings); res = GameAccountSettings.ParseFrom(DBGameAccount.UISettings);
return res; return res;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.UISettings = value.ToByteArray(); dbGAcc.UISettings = value.ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -553,9 +553,9 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
//.SetActionBindingVoiceptt(D3.Client.ActionBinding.CreateBuilder().SetKey1(112).SetKey2(-1).SetKeyModifierFlags1(0).SetKeyModifierFlags2(0).Build()) //.SetActionBindingVoiceptt(D3.Client.ActionBinding.CreateBuilder().SetKey1(112).SetKey2(-1).SetKeyModifierFlags1(0).SetKeyModifierFlags2(0).Build())
.Build(); .Build();
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.UIPrefs = res.ToByteArray(); dbGAcc.UIPrefs = res.ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -567,9 +567,9 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.UIPrefs = value.ToByteArray(); dbGAcc.UIPrefs = value.ToByteArray();
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -590,13 +590,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this._achievements == null) if (_achievements == null)
this.SetField(); SetField();
return this._achievements; return _achievements;
} }
set set
{ {
this._achievements = value; _achievements = value;
} }
} }
@ -604,13 +604,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
if (this._criteria == null) if (_criteria == null)
this.SetField(); SetField();
return this._criteria; return _criteria;
} }
set set
{ {
this._criteria = value; _criteria = value;
} }
} }
@ -620,7 +620,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
uint highestLevel = 1; uint highestLevel = 1;
var _toons = DBSessions.SessionQueryWhere<DBToon>( var _toons = DBSessions.SessionQueryWhere<DBToon>(
dbi => dbi =>
dbi.DBGameAccount.Id == this.PersistentID dbi.DBGameAccount.Id == PersistentID
&& dbi.Class == className).ToList(); && dbi.Class == className).ToList();
foreach (var toon in _toons) foreach (var toon in _toons)
{ {
@ -639,7 +639,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
uint highestLevel = 0; uint highestLevel = 0;
var _toons = DBSessions.SessionQueryWhere<DBToon>( var _toons = DBSessions.SessionQueryWhere<DBToon>(
dbi => dbi =>
dbi.DBGameAccount.Id == this.PersistentID dbi.DBGameAccount.Id == PersistentID
&& dbi.isHardcore == true).ToList(); && dbi.isHardcore == true).ToList();
foreach (var toon in _toons) foreach (var toon in _toons)
{ {
@ -650,7 +650,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
public bool InviteToGuild(Guild guild, GameAccount inviter) public bool InviteToGuild(Guild guild, GameAccount inviter)
{ {
if (guild.IsClan && this.Clan != null) if (guild.IsClan && Clan != null)
return false; return false;
else else
{ {
@ -659,10 +659,10 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
.SetGuildName(guild.Name) .SetGuildName(guild.Name)
.SetInviterId(inviter.PersistentID) .SetInviterId(inviter.PersistentID)
.SetCategory(guild.Category) .SetCategory(guild.Category)
.SetInviteType(inviter.PersistentID == this.PersistentID ? 1U : 0U) .SetInviteType(inviter.PersistentID == PersistentID ? 1U : 0U)
.SetExpireTime(3600); .SetExpireTime(3600);
if (guild.IsClan) invite.SetGuildTag(guild.Prefix); if (guild.IsClan) invite.SetGuildTag(guild.Prefix);
this.GuildInvites.Add(invite.Build()); GuildInvites.Add(invite.Build());
var update = D3.Notification.GuildInvitesListUpdate.CreateBuilder(); var update = D3.Notification.GuildInvitesListUpdate.CreateBuilder();
@ -670,16 +670,16 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
var notification = bgs.protocol.notification.v1.Notification.CreateBuilder(); var notification = bgs.protocol.notification.v1.Notification.CreateBuilder();
notification.SetSenderId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0UL).SetLow(0UL)); notification.SetSenderId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0UL).SetLow(0UL));
notification.SetTargetAccountId(this.Owner.BnetEntityId); notification.SetTargetAccountId(Owner.BnetEntityId);
notification.SetTargetId(this.BnetEntityId); notification.SetTargetId(BnetEntityId);
notification.SetType("D3.NotificationMessage"); notification.SetType("D3.NotificationMessage");
notification.AddAttribute(bgs.protocol.Attribute.CreateBuilder() notification.AddAttribute(bgs.protocol.Attribute.CreateBuilder()
.SetName("D3.NotificationMessage.MessageId").SetValue(bgs.protocol.Variant.CreateBuilder().SetIntValue(0))); .SetName("D3.NotificationMessage.MessageId").SetValue(bgs.protocol.Variant.CreateBuilder().SetIntValue(0)));
notification.AddAttribute(bgs.protocol.Attribute.CreateBuilder() notification.AddAttribute(bgs.protocol.Attribute.CreateBuilder()
.SetName("D3.NotificationMessage.Payload").SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(update.Build().ToByteString()))); .SetName("D3.NotificationMessage.Payload").SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(update.Build().ToByteString())));
this.LoggedInClient.MakeRPC((lid) => LoggedInClient.MakeRPC((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub(this.LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid bgs.protocol.notification.v1.NotificationListener.CreateStub(LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid
}, notification.Build(), callback => { })); }, notification.Build(), callback => { }));
return true; return true;
} }
@ -689,7 +689,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
var profile = AccountProfile.CreateBuilder() var profile = AccountProfile.CreateBuilder()
.SetParagonLevel((uint)dbGAcc.ParagonLevel) .SetParagonLevel((uint)dbGAcc.ParagonLevel)
.SetDeprecatedBestLadderParagonLevel((uint)dbGAcc.ParagonLevel) .SetDeprecatedBestLadderParagonLevel((uint)dbGAcc.ParagonLevel)
@ -701,15 +701,15 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
.SetGoldCollected(dbGAcc.TotalGold) .SetGoldCollected(dbGAcc.TotalGold)
//deprecated //.SetHighestDifficulty(Convert.ToUInt32(progress[0], 10)) //deprecated //.SetHighestDifficulty(Convert.ToUInt32(progress[0], 10))
.SetNumFallenHeroes(3) .SetNumFallenHeroes(3)
.SetParagonLevelHardcore(0) // Уровень совершенства в гер. режиме .SetParagonLevelHardcore(0) // Hardcore Paragon Level
.SetBountiesCompleted((uint)dbGAcc.TotalBounties) //Выполнено поручений .SetBountiesCompleted((uint)dbGAcc.TotalBounties) // Bounties Completed
.SetLootRunsCompleted(0) //Закрыто нефалемских порталов .SetLootRunsCompleted(0) // Loot Runs Completed
.SetPvpWins(0) .SetPvpWins(0)
.SetPvpTakedowns(0) .SetPvpTakedowns(0)
.SetPvpDamage(0) .SetPvpDamage(0)
.SetMonstersKilled(dbGAcc.TotalKilled) //Убито монстров .SetMonstersKilled(dbGAcc.TotalKilled) //Monsters killed
.SetElitesKilled(this.DBGameAccount.ElitesKilled) //Убито особых противников .SetElitesKilled(DBGameAccount.ElitesKilled) //Убито особых противников
.SetGoldCollected(this.DBGameAccount.TotalGold) //Собрано золото .SetGoldCollected(DBGameAccount.TotalGold) //Собрано золото
.SetHighestHardcoreLevel(0) // Максимальный уровень в гер. режиме .SetHighestHardcoreLevel(0) // Максимальный уровень в гер. режиме
.SetHardcoreMonstersKilled(0) // Убито монстров в гер. режиме .SetHardcoreMonstersKilled(0) // Убито монстров в гер. режиме
@ -752,7 +752,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0).Build(); EntityId.CreateBuilder().SetIdHigh(0).SetIdLow(0).Build();
//Platinum //Platinum
public int Platinum { get { return this.DBGameAccount.Platinum; } set { lock (this.DBGameAccount) { var dbGA = this.DBGameAccount; dbGA.Platinum = value; DBSessions.SessionUpdate(dbGA); } } } public int Platinum { get { return DBGameAccount.Platinum; } set { lock (DBGameAccount) { var dbGA = DBGameAccount; dbGA.Platinum = value; DBSessions.SessionUpdate(dbGA); } } }
public List<Toon> Toons public List<Toon> Toons
{ {
@ -763,16 +763,16 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
: base(dbGameAccount.Id) : base(dbGameAccount.Id)
{ {
//DBGameAccount = dbGameAccount; //DBGameAccount = dbGameAccount;
this.AccountId = dbGameAccount.DBAccount.Id; AccountId = dbGameAccount.DBAccount.Id;
if (dbGameAccount.LastPlayedHero != null) if (dbGameAccount.LastPlayedHero != null)
this._currentToonId = dbGameAccount.LastPlayedHero.Id; _currentToonId = dbGameAccount.LastPlayedHero.Id;
this.LastOnline = dbGameAccount.LastOnline; LastOnline = dbGameAccount.LastOnline;
var banner = this.BannerConfiguration; //just pre-loading it var banner = BannerConfiguration; //just pre-loading it
const ulong bnetGameAccountHigh = ((ulong)EntityIdHelper.HighIdType.GameAccountId) + (0x0100004433);// + (0x0100004433); const ulong bnetGameAccountHigh = ((ulong)EntityIdHelper.HighIdType.GameAccountId) + (0x0100004433);// + (0x0100004433);
this.BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh(bnetGameAccountHigh).SetLow(PersistentID).Build(); BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh(bnetGameAccountHigh).SetLow(PersistentID).Build();
this.ProgramField.Value = "D3"; ProgramField.Value = "D3";
} }
private void SetField() private void SetField()
@ -780,7 +780,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
Achievements = new List<AchievementUpdateRecord>(); Achievements = new List<AchievementUpdateRecord>();
AchievementCriteria = new List<CriteriaUpdateRecord>(); AchievementCriteria = new List<CriteriaUpdateRecord>();
var achs = DBSessions.SessionQueryWhere<Core.Storage.AccountDataBase.Entities.DBAchievements>(dbi => dbi.DBGameAccount.Id == this.PersistentID).ToList(); var achs = DBSessions.SessionQueryWhere<Core.Storage.AccountDataBase.Entities.DBAchievements>(dbi => dbi.DBGameAccount.Id == PersistentID).ToList();
foreach (var ach in achs) foreach (var ach in achs)
{ {
if (ach.AchievementId == 1) if (ach.AchievementId == 1)
@ -846,7 +846,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
//checking last online //checking last online
var dbAcc = this.Owner.DBAccount; var dbAcc = Owner.DBAccount;
ChangedFields.SetPresenceFieldValue(GameAccountStatusField); ChangedFields.SetPresenceFieldValue(GameAccountStatusField);
ChangedFields.SetPresenceFieldValue(LastOnlineField); ChangedFields.SetPresenceFieldValue(LastOnlineField);
@ -871,13 +871,13 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return (GameAccountFlags)this.DBGameAccount.Flags | GameAccountFlags.HardcoreAdventureModeUnlocked; return (GameAccountFlags)DBGameAccount.Flags | GameAccountFlags.HardcoreAdventureModeUnlocked;
} }
set set
{ {
lock (this.DBGameAccount) lock (DBGameAccount)
{ {
var dbGAcc = this.DBGameAccount; var dbGAcc = DBGameAccount;
dbGAcc.Flags = (int)value; dbGAcc.Flags = (int)value;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
@ -890,7 +890,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
Digest.Builder builder = Digest.CreateBuilder().SetVersion(116) Digest.Builder builder = Digest.CreateBuilder().SetVersion(116)
// 7447=>99, 7728=> 100, 8801=>102, 8296=>105, 8610=>106, 8815=>106, 8896=>106, 9183=>107 // 7447=>99, 7728=> 100, 8801=>102, 8296=>105, 8610=>106, 8815=>106, 8896=>106, 9183=>107
.SetBannerConfiguration(this.BannerConfiguration) .SetBannerConfiguration(BannerConfiguration)
//.SetFlags((uint)this.Flags) //1 - Enable Hardcore //.SetFlags((uint)this.Flags) //1 - Enable Hardcore
.SetFlags((uint)114) .SetFlags((uint)114)
.SetLastPlayedHeroId(LastPlayedHeroId) .SetLastPlayedHeroId(LastPlayedHeroId)
@ -901,11 +901,11 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
.SetChallengeRiftAccountData(D3.ChallengeRifts.AccountData.CreateBuilder() .SetChallengeRiftAccountData(D3.ChallengeRifts.AccountData.CreateBuilder()
.SetLastChallengeRewardEarned(416175).SetLastChallengeTried(416175) .SetLastChallengeRewardEarned(416175).SetLastChallengeTried(416175)
) )
.AddAltLevels((uint)this.DBGameAccount.ParagonLevel) .AddAltLevels((uint)DBGameAccount.ParagonLevel)
//.AddAltLevels((uint)this.DBGameAccount.ParagonLevelHardcore) //.AddAltLevels((uint)this.DBGameAccount.ParagonLevelHardcore)
; ;
if (this.Clan != null) if (Clan != null)
builder.SetGuildId(this.Clan.PersistentId); builder.SetGuildId(Clan.PersistentId);
return builder.Build(); return builder.Build();
} }
@ -915,7 +915,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
get get
{ {
return (uint)this.Achievements.Where(a => a.Completion != -1).Count() * 10U; return (uint)Achievements.Where(a => a.Completion != -1).Count() * 10U;
} }
} }
@ -925,7 +925,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
{ {
var operations = ChangedFields.GetChangedFieldList(); var operations = ChangedFields.GetChangedFieldList();
ChangedFields.ClearChanged(); ChangedFields.ClearChanged();
base.UpdateSubscribers(Subscribers, operations); UpdateSubscribers(Subscribers, operations);
} }
public override List<FieldOperation> GetSubscriptionNotifications() public override List<FieldOperation> GetSubscriptionNotifications()
@ -968,7 +968,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
operationList.Add(BattleTagField.GetFieldOperation()); operationList.Add(BattleTagField.GetFieldOperation());
operationList.Add(GameAccountNameField.GetFieldOperation()); operationList.Add(GameAccountNameField.GetFieldOperation());
operationList.Add(OwnerIdField.GetFieldOperation()); operationList.Add(OwnerIdField.GetFieldOperation());
if (this.Clan != null) if (Clan != null)
operationList.Add(ClanIdField.GetFieldOperation()); operationList.Add(ClanIdField.GetFieldOperation());
operationList.Add(GameVersionField.GetFieldOperation()); operationList.Add(GameVersionField.GetFieldOperation());
operationList.Add(PartyIdField.GetFieldOperation()); operationList.Add(PartyIdField.GetFieldOperation());
@ -1005,12 +1005,12 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
} }
if (operationsToUpdate.Count > 0) if (operationsToUpdate.Count > 0)
base.UpdateSubscribers(Subscribers, operationsToUpdate); UpdateSubscribers(Subscribers, operationsToUpdate);
} }
public void TestUpdate() public void TestUpdate()
{ {
var operations = this.GetSubscriptionNotifications(); var operations = GetSubscriptionNotifications();
/* /*
operations.Add( operations.Add(
FieldOperation.CreateBuilder() FieldOperation.CreateBuilder()
@ -1038,7 +1038,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
case FieldKeyHelper.Program.D3: case FieldKeyHelper.Program.D3:
if (field.Key.Group == 2 && field.Key.Field == 3) //CurrentActivity if (field.Key.Group == 2 && field.Key.Field == 3) //CurrentActivity
{ {
this.CurrentActivity = (int)field.Value.IntValue; CurrentActivity = (int)field.Value.IntValue;
returnField.SetValue(field.Value); returnField.SetValue(field.Value);
Logger.Trace("{0} set CurrentActivity to {1}", this, field.Value.IntValue); Logger.Trace("{0} set CurrentActivity to {1}", this, field.Value.IntValue);
} }
@ -1068,7 +1068,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
Channel channel = ChannelManager.GetChannelByChannelId(bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue)); Channel channel = ChannelManager.GetChannelByChannelId(bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue));
//this.PartyId = EntityId.CreateBuilder().SetIdLow(NewChannelID.Id).SetIdHigh(0x600000000000000).Build(); //this.PartyId = EntityId.CreateBuilder().SetIdLow(NewChannelID.Id).SetIdHigh(0x600000000000000).Build();
this.PartyChannelId = bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue); PartyChannelId = bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue);
LoggedInClient.CurrentChannel = channel; LoggedInClient.CurrentChannel = channel;
var c = bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue); var c = bgs.protocol.channel.v1.ChannelId.ParseFrom(field.Value.MessageValue);
//returnField.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(PartyChannelId.ToByteString()).Build()); //returnField.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(PartyChannelId.ToByteString()).Build());
@ -1081,7 +1081,7 @@ namespace DiIiS_NA.LoginServer.AccountsSystem
} }
else else
{ {
this.PartyId = null; PartyId = null;
//if(PartyChannelId != null) //if(PartyChannelId != null)
// returnField.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(PartyChannelId.ToByteString()).Build()); // returnField.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(PartyChannelId.ToByteString()).Build());
//else //else

View File

@ -1,4 +1,5 @@
//Blizzless Project 2022 #define LOG_KEEP_ALIVE
//Blizzless Project 2022 //Blizzless Project 2022
using bgs.protocol; using bgs.protocol;
//Blizzless Project 2022 //Blizzless Project 2022
@ -40,7 +41,6 @@ using System.Net.Security;
//Blizzless Project 2022 //Blizzless Project 2022
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DiIiS_NA.LoginServer.Battle namespace DiIiS_NA.LoginServer.Battle
{ {
public class BattleClient : SimpleChannelInboundHandler<BNetPacket>, IRpcChannel public class BattleClient : SimpleChannelInboundHandler<BNetPacket>, IRpcChannel
@ -50,24 +50,21 @@ namespace DiIiS_NA.LoginServer.Battle
public Dictionary<uint, uint> Services { get; private set; } public Dictionary<uint, uint> Services { get; private set; }
public ISocketChannel SocketConnection { get; private set; } public ISocketChannel SocketConnection { get; private set; }
public IChannelHandlerContext Connect { get; private set; } public IChannelHandlerContext Connect { get; private set; }
public bool AuthentificationStatus = false; public bool AuthenticationStatus = false;
public ClientLocale ClientLanguage = ClientLocale.enUS; public ClientLocale ClientLanguage = ClientLocale.enUS;
public IRpcController listenercontroller; public IRpcController ListenerController;
private uint _tokenCounter = 0; private uint _tokenCounter = 0;
public static bgs.protocol.NO_RESPONSE NO_RESPONSE = bgs.protocol.NO_RESPONSE.CreateBuilder().Build(); public static bgs.protocol.NO_RESPONSE NO_RESPONSE = bgs.protocol.NO_RESPONSE.CreateBuilder().Build();
private Dictionary<int, RPCCallBack> pendingResponses = new Dictionary<int, RPCCallBack>(); private readonly Dictionary<int, RPCCallBack> _pendingResponses = new Dictionary<int, RPCCallBack>();
public bgs.protocol.v2.Attribute AttributeOfServer { get; set; } public bgs.protocol.v2.Attribute AttributeOfServer { get; set; }
public Account Account { get; set; } public Account Account { get; set; }
public bool MMJoined = false;
public const byte ServiceReply = 0xFE; public const byte ServiceReply = 0xFE;
public SslStream ssl = null; public SslStream ssl = null;
private static int REQUEST_SERVICE_ID = 0; private static int REQUEST_SERVICE_ID = 0;
private static int RESPONSE_SERVICE_ID = 254; private static int RESPONSE_SERVICE_ID = 254;
public ulong LastPartitionIdHigh = 0; //HACK: fix it later
public ulong LastPartitionIdLow = 0;
//public object clientLock = new object(); //public object clientLock = new object();
public object serviceLock = new object(); public object _serviceLock = new object();
public object messageLock = new object(); public object messageLock = new object();
private ulong _listenerId; // last targeted rpc object. private ulong _listenerId; // last targeted rpc object.
public bool MOTDSent { get; private set; } public bool MOTDSent { get; private set; }
@ -160,20 +157,20 @@ namespace DiIiS_NA.LoginServer.Battle
Services = new Dictionary<uint, uint>(); Services = new Dictionary<uint, uint>();
MappedObjects = new ConcurrentDictionary<ulong, ulong>(); MappedObjects = new ConcurrentDictionary<ulong, ulong>();
this.MOTDSent = false; this.MOTDSent = false;
if (SocketConnection.Active) if (SocketConnection.Active)
Logger.Trace("Клиент - {0} - успешно зашифровал соединение ", socketChannel.RemoteAddress); Logger.Trace("Client - {0} - successfully encrypted the connection", socketChannel.RemoteAddress);
} }
protected override void ChannelRead0(IChannelHandlerContext ctx, BNetPacket msg)
{ protected override void ChannelRead0(IChannelHandlerContext ctx, BNetPacket msg)
{
Connect = ctx; Connect = ctx;
Header header = msg.GetHeader(); Header header = msg.GetHeader();
byte[] payload = (byte[])msg.GetPayload(); byte[] payload = (byte[])msg.GetPayload();
if (msg.GetHeader().ServiceId == RESPONSE_SERVICE_ID) if (msg.GetHeader().ServiceId == RESPONSE_SERVICE_ID)
{ {
if (pendingResponses.Count == 0) return; if (_pendingResponses.Count == 0) return;
RPCCallBack done = pendingResponses[(int)header.Token]; RPCCallBack done = _pendingResponses[(int)header.Token];
if (done != null) if (done != null)
{ {
var service = Service.GetByID(header.ServiceId); var service = Service.GetByID(header.ServiceId);
@ -181,115 +178,131 @@ namespace DiIiS_NA.LoginServer.Battle
{ {
IMessage message = DescriptorProto.ParseFrom(payload); IMessage message = DescriptorProto.ParseFrom(payload);
done.Action(message); done.Action(message);
pendingResponses.Remove((int)header.Token); _pendingResponses.Remove((int)header.Token);
} }
else else
Logger.Debug(String.Format("Incoming Response: Unable to identify service (id: %d, hash: 0x%04X)", header.ServiceId, header.ServiceHash)); Logger.Debug(
$"Incoming Response: Unable to identify service (id: {header.ServiceId}, hash: 0x{header.ServiceHash:04X})");
} }
} }
else else
{ {
var service = Service.GetByID(Service.GetByHash(header.ServiceHash)); var service = Service.GetByID(Service.GetByHash(header.ServiceHash));
if(header.ServiceHash != 2119327385) if (header.ServiceHash != 2119327385)
if (service != null) if (service != null)
{
#region Все хэши сервисов
/*
AccountService - 1658456209
AccountNotify - 1423956503
AuthenticationClient - 1898188341
AuthenticationServer - 233634817
ChallengeNotify - 3151632159
ChannelService - 3073563442
ChannelSubscriber - 3213656212
ChannelVoiceService - 2559626750
ClubMembershipListener - 724851067
ClubMembershipService - 2495170438 - Нужен
ConnectionService - 1698982289
DiagService - 3111080599
FriendsService - 2749215165
FriendsNotify - 1864735251
PresenceListener - 2299181151
PresenceService - 4194801407
ReportService - 2091868617
Resources - 3971904954
SessionListener - 2145610546
SessionService - 510168069
SocialNetworkService - 1910276758
SocialNetworkListener - 3506428651
UserManagerService - 1041835658
UserManagerNotify - 3162975266
WhisperListener - 1072006302
WhisperService - 3240634617
ChannelMembershipService - 2119327385
ChannelMembershipListener - 25167806
ChannelService_v2 - 2039298513
ChannelListener_v2 - 451225222
ReportService_v2 - 977410299
VoiceService_v2 - 4117798472
AccountService - 0x62DA0891
AccountNotify - 0x54DFDA17
AuthenticationClient - 0x71240E35
AuthenticationServer - 0x0DECFC01
ChallengeNotify - 0xBBDA171F
ChannelService - 0xB732DB32
ChannelSubscriber - 0xBF8C8094
ChannelVoiceService - 0x9890CDFE
ClubMembershipListener - 0x2B34597B
ClubMembershipService - 0x94B94786
ConnectionService - 0x65446991
DiagService - 0xB96F5297
FriendsService - 0xA3DDB1BD
FriendsNotify - 0x6F259A13
PresenceListener - 0x890AB85F
PresenceService - 0xFA0796FF
ReportService - 0x7CAF61C9
Resources - ECBE75BA
SessionListener - 0x7FE36B32
SessionService - 0x1E688C05
SocialNetworkService - 0x71DC8296
SocialNetworkListener - 0xD0FFDAEB
UserManagerService - 0x3E19268A
UserManagerNotify - 0xBC872C22
WhisperListener - 0x3FE5849E
WhisperService - 0xC12828F9
ChannelMembershipService - 0x7E525E99
ChannelMembershipListener - 0x018007BE
ChannelService_v2 - 0x798D39D1
ChannelListener_v2 - 0x1AE52686
ReportService_v2 - 0x3A4218FB
VoiceService_v2 - 0xF5709E48
*/
#endregion
MethodDescriptor method = service.DescriptorForType.Methods.Single(m => GetMethodId(m) == header.MethodId);
IMessage proto = service.GetRequestPrototype(method);
IBuilder builder = proto.WeakCreateBuilderForType();
IMessage message = builder.WeakMergeFrom(ByteString.CopyFrom(payload)).WeakBuild();
try
{ {
lock (service) #region All service hashes
/*
AccountService - 1658456209
AccountNotify - 1423956503
AuthenticationClient - 1898188341
AuthenticationServer - 233634817
ChallengeNotify - 3151632159
ChannelService - 3073563442
ChannelSubscriber - 3213656212
ChannelVoiceService - 2559626750
ClubMembershipListener - 724851067
ClubMembershipService - 2495170438 - Нужен
ConnectionService - 1698982289
DiagService - 3111080599
FriendsService - 2749215165
FriendsNotify - 1864735251
PresenceListener - 2299181151
PresenceService - 4194801407
ReportService - 2091868617
Resources - 3971904954
SessionListener - 2145610546
SessionService - 510168069
SocialNetworkService - 1910276758
SocialNetworkListener - 3506428651
UserManagerService - 1041835658
UserManagerNotify - 3162975266
WhisperListener - 1072006302
WhisperService - 3240634617
ChannelMembershipService - 2119327385
ChannelMembershipListener - 25167806
ChannelService_v2 - 2039298513
ChannelListener_v2 - 451225222
ReportService_v2 - 977410299
VoiceService_v2 - 4117798472
AccountService - 0x62DA0891
AccountNotify - 0x54DFDA17
AuthenticationClient - 0x71240E35
AuthenticationServer - 0x0DECFC01
ChallengeNotify - 0xBBDA171F
ChannelService - 0xB732DB32
ChannelSubscriber - 0xBF8C8094
ChannelVoiceService - 0x9890CDFE
ClubMembershipListener - 0x2B34597B
ClubMembershipService - 0x94B94786
ConnectionService - 0x65446991
DiagService - 0xB96F5297
FriendsService - 0xA3DDB1BD
FriendsNotify - 0x6F259A13
PresenceListener - 0x890AB85F
PresenceService - 0xFA0796FF
ReportService - 0x7CAF61C9
Resources - ECBE75BA
SessionListener - 0x7FE36B32
SessionService - 0x1E688C05
SocialNetworkService - 0x71DC8296
SocialNetworkListener - 0xD0FFDAEB
UserManagerService - 0x3E19268A
UserManagerNotify - 0xBC872C22
WhisperListener - 0x3FE5849E
WhisperService - 0xC12828F9
ChannelMembershipService - 0x7E525E99
ChannelMembershipListener - 0x018007BE
ChannelService_v2 - 0x798D39D1
ChannelListener_v2 - 0x1AE52686
ReportService_v2 - 0x3A4218FB
VoiceService_v2 - 0xF5709E48
*/
#endregion
MethodDescriptor method =
service.DescriptorForType.Methods.Single(m => GetMethodId(m) == header.MethodId);
IMessage proto = service.GetRequestPrototype(method);
IBuilder builder = proto.WeakCreateBuilderForType();
IMessage message = builder.WeakMergeFrom(ByteString.CopyFrom(payload)).WeakBuild();
try
{ {
var controller = new HandlerController(); lock (service)
controller.Client = this; {
controller.LastCallHeader = header; HandlerController controller = new()
controller.Status = 0; {
controller.ListenerId = 0; Client = this,
LastCallHeader = header,
Status = 0,
ListenerId = 0
};
#if DEBUG #if DEBUG
Logger.Warn("Вызов: {0}, Хэш сервиса: {1}, Метод: {2}, ID: {3}", service.GetType().Name, header.ServiceHash, method.Name, header.MethodId); #if !LOG_KEEP_ALIVE
if (method.Name != "KeepAlive")
#endif
{
Logger.Warn("Call: {0}, Service hash: {1}, Method: {2}, ID: {3}",
service.GetType().Name, header.ServiceHash, method.Name, header.MethodId);
}
#endif #endif
service.CallMethod(method, controller, message, (IMessage m) => { sendResponse(ctx, (int)header.Token, m, controller.Status); }); service.CallMethod(method, controller, message,
(IMessage m) => { sendResponse(ctx, (int)header.Token, m, controller.Status); });
}
}
catch (NotImplementedException)
{
Logger.Warn("Unimplemented service method: {0}.{1}", service.GetType().Name, method.Name);
} }
} }
catch (NotImplementedException) else
{ {
Logger.Warn("Неимплементированный метод сервиса: {0}.{1}", service.GetType().Name, method.Name); Logger.Warn(
$"Client is calling unconnected service (id: {header.ServiceId}, hash: {header.ServiceHash} Method id: {header.MethodId})");
} }
}
else
Logger.Warn(String.Format("Клиент обращается к неподключенному сервису(id: {0}, hash: {1} Method id: {2})", header.ServiceId, header.ServiceHash, header.MethodId));
} }
} }
@ -434,7 +447,8 @@ namespace DiIiS_NA.LoginServer.Battle
if (!this.Services.ContainsKey(serviceHash)) if (!this.Services.ContainsKey(serviceHash))
{ {
Logger.Warn("Не найден сервис привязанный к клиенту {0} [0x{1}].", serviceName, serviceHash.ToString("X8")); Logger.Warn("Service not found for client {0} [0x{1}].", serviceName, serviceHash.ToString("X8"));
// in english: "Service not found for client {0} [0x{1}]."
return; return;
} }

View File

@ -20,8 +20,8 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
{ {
public class ChannelInvitationManager : RPCObject public class ChannelInvitationManager : RPCObject
{ {
public readonly Dictionary<ulong, bgs.protocol.Invitation> _onGoingInvitations = new Dictionary<ulong, bgs.protocol.Invitation>(); public readonly Dictionary<ulong, Invitation> _onGoingInvitations = new Dictionary<ulong, Invitation>();
public static Dictionary<ulong, bgs.protocol.Invitation> GoingInvitations = new Dictionary<ulong, bgs.protocol.Invitation>(); public static Dictionary<ulong, Invitation> GoingInvitations = new Dictionary<ulong, Invitation>();
public static ulong InvitationIdCounter = 1; public static ulong InvitationIdCounter = 1;
@ -29,13 +29,13 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
{ {
// TODO: Hardcoded 1 as channel persistent id in this case... // TODO: Hardcoded 1 as channel persistent id in this case...
this.BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(10000000000).Build(); BnetEntityId = EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(10000000000).Build();
} }
public bgs.protocol.Invitation GetInvitationById(ulong Id) public Invitation GetInvitationById(ulong Id)
{ {
if (!this._onGoingInvitations.ContainsKey(Id)) if (!_onGoingInvitations.ContainsKey(Id))
{ {
foreach (var inv in _onGoingInvitations.Values) foreach (var inv in _onGoingInvitations.Values)
if (inv.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId.Low == Id) if (inv.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId.Low == Id)
@ -44,20 +44,20 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
} }
else else
return this._onGoingInvitations[Id]; return _onGoingInvitations[Id];
} }
public void ClearInvitations() public void ClearInvitations()
{ {
this._onGoingInvitations.Clear(); _onGoingInvitations.Clear();
} }
public void HandleInvitation(BattleClient client, bgs.protocol.Invitation invitation) public void HandleInvitation(BattleClient client, Invitation invitation)
{ {
var invitee = this.Subscribers.FirstOrDefault(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low == invitation.InviteeIdentity.GameAccountId.Low).Key; var invitee = Subscribers.FirstOrDefault(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low == invitation.InviteeIdentity.GameAccountId.Low).Key;
if (invitee == null) return; if (invitee == null) return;
this._onGoingInvitations.Add(invitation.Id, invitation); _onGoingInvitations.Add(invitation.Id, invitation);
GoingInvitations.Add(invitation.Id, invitation); GoingInvitations.Add(invitation.Id, invitation);
var notification = bgs.protocol.channel.v1.InvitationAddedNotification.CreateBuilder().SetInvitation(invitation); var notification = bgs.protocol.channel.v1.InvitationAddedNotification.CreateBuilder().SetInvitation(invitation);
@ -69,7 +69,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public Channel HandleAccept(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request) public Channel HandleAccept(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request)
{ {
Invitation invitation = null; Invitation invitation = null;
if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) if (!_onGoingInvitations.ContainsKey(request.InvitationId))
{ {
foreach (var inv in _onGoingInvitations.Values) foreach (var inv in _onGoingInvitations.Values)
if(inv.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId.Low == request.InvitationId) if(inv.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId.Low == request.InvitationId)
@ -80,12 +80,12 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
} }
if (invitation == null) if (invitation == null)
invitation = this._onGoingInvitations[request.InvitationId]; invitation = _onGoingInvitations[request.InvitationId];
var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId); var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId);
var notification = bgs.protocol.channel.v1.InvitationRemovedNotification.CreateBuilder().SetInvitation(invitation.ToBuilder()).SetReason((uint)InvitationRemoveReason.Accepted); var notification = bgs.protocol.channel.v1.InvitationRemovedNotification.CreateBuilder().SetInvitation(invitation.ToBuilder()).SetReason((uint)InvitationRemoveReason.Accepted);
this._onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRPC(this, (lid) =>
@ -94,7 +94,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
channel.Join(client, request.ObjectId); channel.Join(client, request.ObjectId);
var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
.SetAgentId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build()) .SetAgentId(EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build())
.SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build()) .SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build())
.Build(); .Build();
@ -109,12 +109,12 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public void HandleHardJoin(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request) public void HandleHardJoin(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request)
{ {
if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return; if (!_onGoingInvitations.ContainsKey(request.InvitationId)) return;
var invitation = this._onGoingInvitations[request.InvitationId]; var invitation = _onGoingInvitations[request.InvitationId];
var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId); var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId);
this._onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
var a = GameAccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.GameAccountId.Low); var a = GameAccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.GameAccountId.Low);
var JoinClient = a.LoggedInClient; var JoinClient = a.LoggedInClient;
@ -132,10 +132,10 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
var notification = bgs.protocol.matchmaking.v1.MatchmakingResultNotification.CreateBuilder(); var notification = bgs.protocol.matchmaking.v1.MatchmakingResultNotification.CreateBuilder();
var connectInfo = bgs.protocol.matchmaking.v1.ConnectInfo.CreateBuilder(); var connectInfo = bgs.protocol.matchmaking.v1.ConnectInfo.CreateBuilder();
connectInfo.SetAddress(bgs.protocol.Address.CreateBuilder().SetAddress_(GAME_SERVER_IP).SetPort(GAME_SERVER_PORT)); connectInfo.SetAddress(Address.CreateBuilder().SetAddress_(GAME_SERVER_IP).SetPort(GAME_SERVER_PORT));
connectInfo.AddAttribute(bgs.protocol.v2.Attribute.CreateBuilder().SetName("GameAccount").SetValue(bgs.protocol.v2.Variant.CreateBuilder().SetBlobValue(member.Build().ToByteString()))); connectInfo.AddAttribute(bgs.protocol.v2.Attribute.CreateBuilder().SetName("GameAccount").SetValue(bgs.protocol.v2.Variant.CreateBuilder().SetBlobValue(member.Build().ToByteString())));
connectInfo.AddAttribute(bgs.protocol.v2.Attribute.CreateBuilder().SetName("Token").SetValue(bgs.protocol.v2.Variant.CreateBuilder().SetUintValue(0xEEF4364684EE186E))); // FIXME connectInfo.AddAttribute(bgs.protocol.v2.Attribute.CreateBuilder().SetName("Token").SetValue(bgs.protocol.v2.Variant.CreateBuilder().SetUintValue(0xEEF4364684EE186E))); // FIXME
//connectInfo.AddAttribute(AttributeOfServer); // Настройки игры //connectInfo.AddAttribute(AttributeOfServer); // Game settings
var gh = bgs.protocol.matchmaking.v1.GameHandle.CreateBuilder(); var gh = bgs.protocol.matchmaking.v1.GameHandle.CreateBuilder();
gh.SetMatchmaker(bgs.protocol.matchmaking.v1.MatchmakerHandle.CreateBuilder() gh.SetMatchmaker(bgs.protocol.matchmaking.v1.MatchmakerHandle.CreateBuilder()
@ -155,9 +155,9 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
if (JoinClient.CurrentChannel != null) if (JoinClient.CurrentChannel != null)
{ {
var channelStatePermission = bgs.protocol.channel.v1.ChannelState.CreateBuilder() var channelStatePermission = bgs.protocol.channel.v1.ChannelState.CreateBuilder()
.AddAttribute(bgs.protocol.Attribute.CreateBuilder() .AddAttribute(Attribute.CreateBuilder()
.SetName("D3.Party.JoinPermissionPreviousToLock") .SetName("D3.Party.JoinPermissionPreviousToLock")
.SetValue(bgs.protocol.Variant.CreateBuilder().SetIntValue(1).Build()) .SetValue(Variant.CreateBuilder().SetIntValue(1).Build())
.Build()).Build(); .Build()).Build();
var notificationPermission = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() var notificationPermission = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
@ -174,9 +174,9 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.SetSenderId(client.Account.GameAccount.BnetEntityId) .SetSenderId(client.Account.GameAccount.BnetEntityId)
.SetTargetId(JoinClient.Account.GameAccount.BnetEntityId) .SetTargetId(JoinClient.Account.GameAccount.BnetEntityId)
.SetType("GO_ENTRY"); .SetType("GO_ENTRY");
var attrF = bgs.protocol.Attribute.CreateBuilder() var attrF = Attribute.CreateBuilder()
.SetName("game_request_id") .SetName("game_request_id")
.SetValue(bgs.protocol.Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build()); .SetValue(Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build());
notificationFound.AddAttribute(attrF); notificationFound.AddAttribute(attrF);
JoinClient.MakeRPC((lid) => JoinClient.MakeRPC((lid) =>
@ -234,7 +234,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
channel.Join(client, request.ObjectId); channel.Join(client, request.ObjectId);
var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
.SetAgentId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build()) .SetAgentId(EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build())
.SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build()) .SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build())
.Build(); .Build();
@ -256,13 +256,13 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public Channel HandleAcceptAnother(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request) public Channel HandleAcceptAnother(BattleClient client, bgs.protocol.channel.v1.AcceptInvitationRequest request)
{ {
if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return null; if (!_onGoingInvitations.ContainsKey(request.InvitationId)) return null;
var invitation = this._onGoingInvitations[request.InvitationId]; var invitation = _onGoingInvitations[request.InvitationId];
var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId); var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bgs.protocol.channel.v1.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId);
var notification = bgs.protocol.channel.v1.InvitationRemovedNotification.CreateBuilder().SetInvitation(invitation.ToBuilder()).SetReason((uint)InvitationRemoveReason.Accepted); var notification = bgs.protocol.channel.v1.InvitationRemovedNotification.CreateBuilder().SetInvitation(invitation.ToBuilder()).SetReason((uint)InvitationRemoveReason.Accepted);
this._onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
var a = GameAccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.GameAccountId.Low); var a = GameAccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.GameAccountId.Low);
//client.MakeTargetedRPC(this, (lid) => //client.MakeTargetedRPC(this, (lid) =>
@ -280,7 +280,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low); var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low);
var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() var stateNotification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
.SetAgentId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build()) .SetAgentId(EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build())
.SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build()) .SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation).SetReason(0).Build())
.Build(); .Build();
@ -298,19 +298,19 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public void HandleDecline(BattleClient client, bgs.protocol.channel.v1.DeclineInvitationRequest request) public void HandleDecline(BattleClient client, bgs.protocol.channel.v1.DeclineInvitationRequest request)
{ {
if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return; if (!_onGoingInvitations.ContainsKey(request.InvitationId)) return;
var invitation = this._onGoingInvitations[request.InvitationId]; var invitation = _onGoingInvitations[request.InvitationId];
var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low); var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low);
if (inviter == null || inviter.LoggedInClient == null) return; if (inviter == null || inviter.LoggedInClient == null) return;
var notification = var notification =
bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
.SetAgentId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0)) // caps have this set to high: 0 low: 0 /raist. .SetAgentId(EntityId.CreateBuilder().SetHigh(0).SetLow(0)) // caps have this set to high: 0 low: 0 /raist.
.SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation) .SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation)
.SetReason((uint)InvitationRemoveReason.Declined)); .SetReason((uint)InvitationRemoveReason.Declined));
this._onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) => inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) =>
@ -319,9 +319,9 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public void Revoke(BattleClient client, bgs.protocol.channel.v1.RevokeInvitationRequest request) public void Revoke(BattleClient client, bgs.protocol.channel.v1.RevokeInvitationRequest request)
{ {
if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return; if (!_onGoingInvitations.ContainsKey(request.InvitationId)) return;
this.CheckSubscribers(); CheckSubscribers();
var invitation = this._onGoingInvitations[request.InvitationId]; var invitation = _onGoingInvitations[request.InvitationId];
var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low); var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.GameAccountId.Low);
var channel = ChannelManager.GetChannelByEntityId(request.ChannelId); var channel = ChannelManager.GetChannelByEntityId(request.ChannelId);
@ -329,11 +329,11 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
//notify inviter about revoke //notify inviter about revoke
var updateChannelNotification = var updateChannelNotification =
bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder() bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder()
.SetAgentId(bgs.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0)) // caps have this set to high: 0 low: 0 /dustin .SetAgentId(EntityId.CreateBuilder().SetHigh(0).SetLow(0)) // caps have this set to high: 0 low: 0 /dustin
.SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation) .SetStateChange(bgs.protocol.channel.v1.ChannelState.CreateBuilder().AddInvitation(invitation)
.SetReason((uint)InvitationRemoveReason.Revoked)); .SetReason((uint)InvitationRemoveReason.Revoked));
this._onGoingInvitations.Remove(request.InvitationId); _onGoingInvitations.Remove(request.InvitationId);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) => inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) =>
@ -345,7 +345,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.SetInvitation(invitation); .SetInvitation(invitation);
//.SetReason((uint)InvitationRemoveReason.Declined); //.SetReason((uint)InvitationRemoveReason.Declined);
if (!this.Subscribers.Any(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low == invitation.InviteeIdentity.AccountId.Low)) return; if (Subscribers.All(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low != invitation.InviteeIdentity.AccountId.Low)) return;
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRPC(this, (lid) =>
bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, invitationRemoved.Build(), callback => { })); bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, invitationRemoved.Build(), callback => { }));

View File

@ -248,19 +248,20 @@ namespace DiIiS_NA.LoginServer.GamesSystem
switch (request.Partition) switch (request.Partition)
{ {
case 1: //Кампания case 1: //"Campaign"
handicap = request.HandicapLevel; handicap = request.HandicapLevel;
Difficulty = request.MonsterLevel; Difficulty = request.MonsterLevel;
GameTag = request.GameTag; GameTag = request.GameTag;
GameAct = request.GameAct; GameAct = request.GameAct;
GameQuest = request.GameQuest; GameQuest = request.GameQuest;
break; break;
case 2: //Приключения case 2: //"Adventure"
Difficulty = request.HandicapLevel; Difficulty = request.HandicapLevel;
GameTag = request.GameTag; GameTag = request.GameTag;
break; break;
case 3: //Порталы дерзаний case 3: //"Adventure"
break; break;
} }

View File

@ -48,19 +48,19 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
public override void Logon(IRpcController controller, LogonRequest request, Action<NoData> done) public override void Logon(IRpcController controller, LogonRequest request, Action<NoData> done)
{ {
//Error 28 - Появилось обновление Diablo III, клиент закрывается. //Error 28 - There is an update for Diablo III, the client is closing.
//Error 33 - Профилактические работы //Error 33 - Maintenance
//Error 35 - Служба Battle.net - Отключена //Error 35 - Battle.net service - Disabled
//Error 36 - Не удалось загрузить модуль аутентификации //Error 36 - Failed to load authentication module
//Error 37 - Служба аутентификации получает слишком много обращений. //Error 37 - Authentication service is receiving too many requests.
//Error 38 - Для игры требуется получить BattleTag //Error 38 - To play you need to get BattleTag
//Error 42 - Вы подключаетесь к неверному серверу (Неверная последовательность действий) //Error 42 - You are connecting to the wrong server (Wrong sequence of actions)
//Error 43 - Вы заблокировали свою учетную запись с мобильного телефона. //Error 43 - You blocked your account from your mobile phone.
//Error 44 - Невозможно выполнить это действие. Учетная запись лишена функции голосового общения. //Error 44 - Unable to perform this action. The account is deprived of the function of voice communication.
//Error 50 - Предоплаченное для учетной записи время игры истекло. //Error 50 - Prepaid time for the account has expired.
//Error 51 - Подписка для данной учетной записи истекла. //Error 51 - Subscription for this account has expired.
//Error 52 - Данная учетная запись была заблокирована в связи с многочисленными нарушениями условий использования службы Battle.net //Error 52 - This account has been blocked due to numerous violations of the terms of use of the Battle.net service
//Error 53 - Действие данной учетной записи было приостановлено в связи с нарушениями условий использования службы Batle.net. //Error 53: Action of this account has been suspended due to violations of the terms of use of the Batle.net service
int VersionRetail = 81850; //74291 - 2.7.0, 76761 - 2.7.1, 79575 - 2.7.2; int VersionRetail = 81850; //74291 - 2.7.0, 76761 - 2.7.1, 79575 - 2.7.2;
int VersionPTR = 79151; int VersionPTR = 79151;
@ -82,9 +82,9 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
} }
if (request.ApplicationVersion == 0) if (request.ApplicationVersion == 0)
{ {
var Parts = request.Version.Split('"'); var parts = request.Version.Split('"');
if (Parts.Length > 1) if (parts.Length > 1)
version = Parts[1]; version = parts[1];
} }
else else
version = request.ApplicationVersion.ToString(); version = request.ApplicationVersion.ToString();
@ -92,27 +92,27 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
if (request.Program.ToLower() == "d3") if (request.Program.ToLower() == "d3")
if (request.ApplicationVersion != VersionRetail & request.ApplicationVersion != VersionPTR) if (request.ApplicationVersion != VersionRetail & request.ApplicationVersion != VersionPTR)
{ {
//Logger.Error("Подключение не правильной версии клиента!"); //Logger.Error("Connecting the wrong client version!");
var ercomplete = LogonResult.CreateBuilder().SetErrorCode(28); var ercomplete = LogonResult.CreateBuilder().SetErrorCode(28);
//(controller as HandlerController).Client.MakeRPC((lid) => AuthenticationListener.CreateStub((controller as HandlerController).Client).OnLogonComplete(controller, ercomplete.Build(), callback => { })); //((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, ercomplete.Build(), callback => { }));
} }
switch (request.Locale) switch (request.Locale)
{ {
case "deDE": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.deDE; break; case "deDE": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.deDE; break;
case "enGB": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enGB; break; case "enGB": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enGB; break;
case "enSG": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enSG; break; case "enSG": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enSG; break;
case "enUS": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enUS; break; case "enUS": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.enUS; break;
case "esES": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.esES; break; case "esES": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.esES; break;
case "esMX": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.esMX; break; case "esMX": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.esMX; break;
case "frFR": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.frFR; break; case "frFR": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.frFR; break;
case "itIT": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.itIT; break; case "itIT": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.itIT; break;
case "koKR": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.koKR; break; case "koKR": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.koKR; break;
case "plPL": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.plPL; break; case "plPL": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.plPL; break;
case "ptBR": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ptBR; break; case "ptBR": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ptBR; break;
case "ptPT": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ptPT; break; case "ptPT": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ptPT; break;
case "ruRU": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ruRU; break; case "ruRU": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.ruRU; break;
case "trTR": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.trTR; break; case "trTR": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.trTR; break;
case "zhCN": (controller as HandlerController).Client.ClientLanguage = Battle.BattleClient.ClientLocale.zhCN; break; case "zhCN": ((HandlerController)controller).Client.ClientLanguage = Battle.BattleClient.ClientLocale.zhCN; break;
} }
done(NoData.CreateBuilder().Build()); done(NoData.CreateBuilder().Build());
Logger.Info("----------------------------------------------------------------"); Logger.Info("----------------------------------------------------------------");
@ -123,21 +123,23 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
case "d3": case "d3":
//if (!request.HasCachedWebCredentials) //if (!request.HasCachedWebCredentials)
{ {
#region Процедура аутентификации через WEB #region Authentication procedure through WEB
if (request.HasCachedWebCredentials) if (request.HasCachedWebCredentials)
VerifyWebCredentials(controller, VerifyWebCredentialsRequest.CreateBuilder().SetWebCredentials(request.CachedWebCredentials).Build(), callback => { }); VerifyWebCredentials(controller, VerifyWebCredentialsRequest.CreateBuilder().SetWebCredentials(request.CachedWebCredentials).Build(), callback => { });
builder.SetPayloadType("web_auth_url"); builder.SetPayloadType("web_auth_url");
if (REST.Config.Instance.Public) if (REST.Config.Instance.Public)
builder.SetPayload(ByteString.CopyFromUtf8(String.Format("http://{0}:{1}/battlenet/login", REST.Config.Instance.PublicIP, REST.Config.Instance.PORT))); builder.SetPayload(ByteString.CopyFromUtf8(
$"http://{REST.Config.Instance.PublicIP}:{REST.Config.Instance.PORT}/battlenet/login"));
else else
builder.SetPayload(ByteString.CopyFromUtf8(String.Format("http://{0}:{1}/battlenet/login", Program.RESTSERVERIP, REST.Config.Instance.PORT))); builder.SetPayload(ByteString.CopyFromUtf8(
$"http://{Program.RESTSERVERIP}:{REST.Config.Instance.PORT}/battlenet/login"));
(controller as HandlerController).Client.MakeRPC((lid) => ChallengeListener.CreateStub((controller as HandlerController).Client).OnExternalChallenge(controller, builder.Build(), callback => { })); ((HandlerController)controller).Client.MakeRPC((lid) => ChallengeListener.CreateStub(((HandlerController)controller).Client).OnExternalChallenge(controller, builder.Build(), callback => { }));
#endregion #endregion
} }
break; break;
default: default:
Logger.Error("Authorization not implemeted for Game: {0}", game); Logger.Error("Authorization not implemented for Game: {0}", game);
Logger.Info("----------------------------------------------------------------"); Logger.Info("----------------------------------------------------------------");
break; break;
} }
@ -170,10 +172,10 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
#region Authentication complete #region Authentication complete
if (request.WebCredentials.ToStringUtf8().ToLower().Contains("eu-")) if (request.WebCredentials.ToStringUtf8().ToLower().Contains("eu-"))
{ {
(controller as HandlerController).Client.Account = AccountManager.GetAccountByPersistentID(1); ((HandlerController)controller).Client.Account = AccountManager.GetAccountByPersistentID(1);
var comple = LogonResult.CreateBuilder() var comple = LogonResult.CreateBuilder()
.SetAccountId((controller as HandlerController).Client.Account.BnetEntityId) .SetAccountId(((HandlerController)controller).Client.Account.BnetEntityId)
.SetEmail("TEST@MAIL.DU") .SetEmail("TEST@MAIL.DU")
.SetBattleTag("Test#0000") .SetBattleTag("Test#0000")
.SetSessionKey(ByteString.CopyFrom("7CB18EDA470F96A4DD70C70B9307CBBA2A4131043075648D8B2F55EE0E383132025D3CC3BA43406DC0740D776B1E5C366BD1123D16E6D6759075B475C28C4022".ToByteArray())) .SetSessionKey(ByteString.CopyFrom("7CB18EDA470F96A4DD70C70B9307CBBA2A4131043075648D8B2F55EE0E383132025D3CC3BA43406DC0740D776B1E5C366BD1123D16E6D6759075B475C28C4022".ToByteArray()))
@ -184,49 +186,49 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
.SetGeoipCountry("RU") .SetGeoipCountry("RU")
.SetRestrictedMode(false) .SetRestrictedMode(false)
.SetErrorCode(0); .SetErrorCode(0);
comple.AddGameAccountId((controller as HandlerController).Client.Account.GameAccount.BnetEntityId); comple.AddGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId);
(controller as HandlerController).Client.Account.GameAccount.LoggedInClient = (controller as HandlerController).Client; ((HandlerController)controller).Client.Account.GameAccount.LoggedInClient = ((HandlerController)controller).Client;
(controller as HandlerController).Client.MakeRPC((lid) => AuthenticationListener.CreateStub((controller as HandlerController).Client).OnLogonComplete(controller, comple.Build(), callback => { })); ((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, comple.Build(), callback => { }));
(controller as HandlerController).Client.Account.GameAccount.ProgramField.Value = "FEN"; ((HandlerController)controller).Client.Account.GameAccount.ProgramField.Value = "FEN";
PlayerManager.PlayerConnected((controller as HandlerController).Client); PlayerManager.PlayerConnected(((HandlerController)controller).Client);
var ga1selected = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId((controller as HandlerController).Client.Account.GameAccount.BnetEntityId); var ga1selected = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId);
(controller as HandlerController).Client.MakeRPC((lid) => ((HandlerController)controller).Client.MakeRPC((lid) =>
AuthenticationListener.CreateStub((controller as HandlerController).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, ga1selected.Build(), callback => { })); AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, ga1selected.Build(), callback => { }));
} }
else else
{ {
(controller as HandlerController).Client.Account = AccountManager.GetAccountBySaltTicket(request.WebCredentials.ToStringUtf8()); ((HandlerController)controller).Client.Account = AccountManager.GetAccountBySaltTicket(request.WebCredentials.ToStringUtf8());
if ((controller as HandlerController).Client.Account == null) if (((HandlerController)controller).Client.Account == null)
{ {
var complete = LogonResult.CreateBuilder().SetErrorCode(2); var complete = LogonResult.CreateBuilder().SetErrorCode(2);
(controller as HandlerController).Client.MakeRPC((lid) => AuthenticationListener.CreateStub((controller as HandlerController).Client).OnLogonComplete(controller, complete.Build(), callback => { })); ((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { }));
(controller as HandlerController).Client.SocketConnection.CloseAsync(); ((HandlerController)controller).Client.SocketConnection.CloseAsync();
(controller as HandlerController).Client.Connect.CloseAsync(); ((HandlerController)controller).Client.Connect.CloseAsync();
} }
else else
{ {
Logger.Info("Client connected - {0}#{1}", (controller as HandlerController).Client.Account.DBAccount.BattleTagName, (controller as HandlerController).Client.Account.HashCode); Logger.Info("Client connected - {0}#{1}", ((HandlerController)controller).Client.Account.DBAccount.BattleTagName, ((HandlerController)controller).Client.Account.HashCode);
Logger.Info("----------------------------------------------------------------"); Logger.Info("----------------------------------------------------------------");
var complete = LogonResult.CreateBuilder() var complete = LogonResult.CreateBuilder()
.SetAccountId((controller as HandlerController).Client.Account.BnetEntityId) .SetAccountId(((HandlerController)controller).Client.Account.BnetEntityId)
.SetEmail((controller as HandlerController).Client.Account.Email) .SetEmail(((HandlerController)controller).Client.Account.Email)
.SetBattleTag((controller as HandlerController).Client.Account.BattleTag) .SetBattleTag(((HandlerController)controller).Client.Account.BattleTag)
.AddAvailableRegion(1) .AddAvailableRegion(1)
.SetConnectedRegion(1) .SetConnectedRegion(1)
.SetGeoipCountry("RU") .SetGeoipCountry("RU")
.SetRestrictedMode(false) .SetRestrictedMode(false)
.SetErrorCode(0); .SetErrorCode(0);
complete.AddGameAccountId((controller as HandlerController).Client.Account.GameAccount.BnetEntityId); //D3 complete.AddGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId); //D3
(controller as HandlerController).Client.Account.GameAccount.LoggedInClient = (controller as HandlerController).Client; ((HandlerController)controller).Client.Account.GameAccount.LoggedInClient = ((HandlerController)controller).Client;
(controller as HandlerController).Client.MakeRPC((lid) => AuthenticationListener.CreateStub((controller as HandlerController).Client).OnLogonComplete(controller, complete.Build(), callback => { })); ((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { }));
PlayerManager.PlayerConnected((controller as HandlerController).Client); PlayerManager.PlayerConnected(((HandlerController)controller).Client);
var gaselected = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId((controller as HandlerController).Client.Account.GameAccount.BnetEntityId); var gaselected = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId);
(controller as HandlerController).Client.MakeRPC((lid) => ((HandlerController)controller).Client.MakeRPC((lid) =>
AuthenticationListener.CreateStub((controller as HandlerController).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, gaselected.Build(), callback => { })); AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, gaselected.Build(), callback => { }));
} }
} }
#endregion #endregion

View File

@ -98,7 +98,7 @@ namespace DiIiS_NA.Core.Discord.Modules
var messages = await Context.Guild.GetTextChannel(AnnounceChannelId).GetMessagesAsync(10).FlattenAsync(); var messages = await Context.Guild.GetTextChannel(AnnounceChannelId).GetMessagesAsync(10).FlattenAsync();
await Context.Guild.GetTextChannel(AnnounceChannelId).DeleteMessagesAsync(messages); await Context.Guild.GetTextChannel(AnnounceChannelId).DeleteMessagesAsync(messages);
await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync("Servers status: :tools: **PLANNED MAINTENANCE**."); 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}** минут для плановых профилактических работ."); await Context.Guild.GetTextChannel(AnnounceChannelId).SendMessageAsync($"@here Servers will be restarted in **{minutes}** minutes for a planned maintenance.");
} }
[Command("online")] [Command("online")]

View File

@ -24830,10 +24830,12 @@ namespace DiIiS_NA.Core.MPQ
#endregion #endregion
return DictSNOConversation; return DictSNOConversation;
} }
public static Dictionary<string, int> DictSNOEffectGroup = new Dictionary<string, int>();
public static Dictionary<string, int> LoadEffectGroup() public static Dictionary<string, int> LoadEffectGroup()
{ {
Dictionary<string, int> DictSNOEffectGroup = new Dictionary<string, int>();
#region EffectGroup #region EffectGroup
DictSNOEffectGroup.Clear();
DictSNOEffectGroup.Add("A1C4HouseFireSmall", 1111); DictSNOEffectGroup.Add("A1C4HouseFireSmall", 1111);
DictSNOEffectGroup.Add("a1dun_Leor_Barrel_Torture_A_01_guts", 87589); DictSNOEffectGroup.Add("a1dun_Leor_Barrel_Torture_A_01_guts", 87589);
DictSNOEffectGroup.Add("a1dun_leor_BigFireGrate", 108018); DictSNOEffectGroup.Add("a1dun_leor_BigFireGrate", 108018);

View File

@ -42,7 +42,7 @@ namespace DiIiS_NA.Core.MPQ
return; return;
} }
this.BaseMPQFiles.Add(mpqFile); this.BaseMPQFiles.Add(mpqFile);
Logger.Trace("Добавлено хранилище MPQ: {0}.", file); Logger.Trace("Added MPQ storage: {0}.", file);
} }
this.PatchPattern = patchPattern; this.PatchPattern = patchPattern;
@ -93,11 +93,11 @@ namespace DiIiS_NA.Core.MPQ
{ {
foreach (var mpq in pair.Value) foreach (var mpq in pair.Value)
{ {
Logger.Trace("Архив: {0}, включен в систему.", System.IO.Path.GetFileName(mpq)); Logger.Trace("MPQ: {0}, added to the system.", System.IO.Path.GetFileName(mpq));
this.FileSystem.Archives.Add(new MpqArchive(new FileStream(mpq, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), true)); this.FileSystem.Archives.Add(new MpqArchive(new FileStream(mpq, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), true));
} }
} }
Logger.Trace("Система сконструирована."); Logger.Trace("MPQ system constructed.");
} }
} }
} }

View File

@ -32,11 +32,11 @@ namespace DiIiS_NA.Core.MPQ
if (!Directory.Exists(MpqRoot)) if (!Directory.Exists(MpqRoot))
{ {
Logger.Error("MPQ арихивы не найдены: {0}.", MpqRoot); Logger.Error("MPQ archives not found: {0}.", MpqRoot);
return; return;
} }
Logger.Info("Initializating of data.."); Logger.Info("Initializing of data..");
MPQList = FileHelpers.GetFilesByExtensionRecursive(MpqRoot, ".mpq"); MPQList = FileHelpers.GetFilesByExtensionRecursive(MpqRoot, ".mpq");
Data = new Data(); Data = new Data();

View File

@ -181,7 +181,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client.serviceLock) lock (client._serviceLock)
{ {
Logger.Trace("GrantAchievement(): id {0}", achievementId); Logger.Trace("GrantAchievement(): id {0}", achievementId);
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return; if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
@ -202,7 +202,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
DBGameAccount = client.Account.GameAccount.DBGameAccount, DBGameAccount = client.Account.GameAccount.DBGameAccount,
AchievementId = achievementId, AchievementId = achievementId,
Criteria = new byte[0], Criteria = new byte[0],
IsHardcore = AchievementManager.IsHardcore(achievementId), IsHardcore = IsHardcore(achievementId),
CompleteTime = (int)DateTime.Now.ToUnixTime() CompleteTime = (int)DateTime.Now.ToUnixTime()
}; };
DBSessions.SessionSave(achievement); DBSessions.SessionSave(achievement);
@ -222,7 +222,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
UpdateSnapshot(client, achievementId); UpdateSnapshot(client, achievementId);
if (AchievementManager.IsHardcore(achievementId)) if (IsHardcore(achievementId))
{ {
if (achs.Where(a => a.CompleteTime != -1 && a.IsHardcore == true).Count() >= 30) //31 in total if (achs.Where(a => a.CompleteTime != -1 && a.IsHardcore == true).Count() >= 30) //31 in total
{ {
@ -246,7 +246,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client.serviceLock) lock (client._serviceLock)
{ {
Logger.Trace("GrantCriteria(): id {0}", criteriaId); Logger.Trace("GrantCriteria(): id {0}", criteriaId);
D3.AchievementsStaticData.StaticCriteriaDefinition definition = null; D3.AchievementsStaticData.StaticCriteriaDefinition definition = null;
@ -271,7 +271,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
Logger.Trace("GrantCriteria(): creating new ach data"); Logger.Trace("GrantCriteria(): creating new ach data");
achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount; achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount;
achievement.AchievementId = definition.ParentAchievementId; achievement.AchievementId = definition.ParentAchievementId;
achievement.IsHardcore = AchievementManager.IsHardcore(definition.ParentAchievementId); achievement.IsHardcore = IsHardcore(definition.ParentAchievementId);
achievement.CompleteTime = -1; achievement.CompleteTime = -1;
achievement.Quantity = 0; achievement.Quantity = 0;
List<uint> crits = new List<uint>(); List<uint> crits = new List<uint>();
@ -381,13 +381,13 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client.serviceLock) lock (client._serviceLock)
{ {
if (additionalQuantity == 0) return; if (additionalQuantity == 0) return;
Logger.Trace("UpdateQuantity(): id {0}", achievementId); Logger.Trace("UpdateQuantity(): id {0}", achievementId);
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return; if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
ulong mainCriteriaId = AchievementManager.GetMainCriteria(achievementId); ulong mainCriteriaId = GetMainCriteria(achievementId);
var aa = client.Account.GameAccount.AchievementCriteria; var aa = client.Account.GameAccount.AchievementCriteria;
D3.Achievements.CriteriaUpdateRecord mainCriteria; D3.Achievements.CriteriaUpdateRecord mainCriteria;
lock (client.Account.GameAccount.AchievementCriteria) lock (client.Account.GameAccount.AchievementCriteria)
@ -420,7 +420,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
Logger.Trace("UpdateQuantity(): creating new ach data"); Logger.Trace("UpdateQuantity(): creating new ach data");
achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount; achievement.DBGameAccount = client.Account.GameAccount.DBGameAccount;
achievement.AchievementId = achievementId; achievement.AchievementId = achievementId;
achievement.IsHardcore = AchievementManager.IsHardcore(achievementId); achievement.IsHardcore = IsHardcore(achievementId);
achievement.CompleteTime = -1; achievement.CompleteTime = -1;
List<uint> crits = new List<uint>(); List<uint> crits = new List<uint>();
achievement.Criteria = SerializeBytes(crits); achievement.Criteria = SerializeBytes(crits);

View File

@ -31,18 +31,18 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
// Note that this method should only be called prior to encryption! // Note that this method should only be called prior to encryption!
public int Receive(int start, int count) public int Receive(int start, int count)
{ {
return this.Socket.Receive(_recvBuffer, start, count, SocketFlags.None); return Socket.Receive(_recvBuffer, start, count, SocketFlags.None);
} }
// Wrapper for the Send method that will send the data either to the // Wrapper for the Send method that will send the data either to the
// Socket (unecnrypted) or to the TLSStream (encrypted). // Socket (unecnrypted) or to the TLSStream (encrypted).
public int _Send(byte[] buffer, int start, int count, SocketFlags flags) public int _Send(byte[] buffer, int start, int count, SocketFlags flags)
{ {
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
int bytes = 0; int bytes = 0;
try try
{ {
bytes = this.Socket.Send(buffer, start, count, flags); bytes = Socket.Send(buffer, start, count, flags);
} }
catch catch
{ {
@ -79,8 +79,8 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
if (socket == null) if (socket == null)
throw new ArgumentNullException("socket"); throw new ArgumentNullException("socket");
this.LastKeepAliveTick = DateTime.Now.ToUnixTime(); LastKeepAliveTick = DateTime.Now.ToUnixTime();
this.Socket = socket; Socket = socket;
} }
#region socket stuff #region socket stuff
@ -122,10 +122,10 @@ using (var socketEventargs = new SocketAsyncEventArgs())
socketEventargs.SetBuffer(_recvBuffer, 0, BufferSize); socketEventargs.SetBuffer(_recvBuffer, 0, BufferSize);
socketEventargs.Completed += (sender, args) => ReadCallback(args); socketEventargs.Completed += (sender, args) => ReadCallback(args);
socketEventargs.SocketFlags = SocketFlags.None; socketEventargs.SocketFlags = SocketFlags.None;
socketEventargs.RemoteEndPoint = this.Socket.RemoteEndPoint; socketEventargs.RemoteEndPoint = Socket.RemoteEndPoint;
socketEventargs.UserToken = this; socketEventargs.UserToken = this;
if (!this.Socket.ReceiveAsync(socketEventargs)) if (!Socket.ReceiveAsync(socketEventargs))
ReadCallback(socketEventargs); ReadCallback(socketEventargs);
} }
} }
@ -153,7 +153,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
{ {
if (a.BytesTransferred > 0) if (a.BytesTransferred > 0)
{ {
this.Server.OnDataReceived(new ConnectionDataEventArgs(connection, connection.RecvBuffer.Enumerate(0, a.BytesTransferred))); // Raise the DataReceived event. Server.OnDataReceived(new ConnectionDataEventArgs(connection, connection.RecvBuffer.Enumerate(0, a.BytesTransferred))); // Raise the DataReceived event.
if (connection.IsOpen()) if (connection.IsOpen())
connection.AsyncRead(); connection.AsyncRead();
@ -184,7 +184,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer) public int Send(byte[] buffer)
{ {
if (buffer == null) throw new ArgumentNullException("buffer"); if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
return Send(buffer, 0, buffer.Length, SocketFlags.None); return Send(buffer, 0, buffer.Length, SocketFlags.None);
} }
@ -197,7 +197,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, SocketFlags flags) public int Send(byte[] buffer, SocketFlags flags)
{ {
if (buffer == null) throw new ArgumentNullException("buffer"); if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
return Send(buffer, 0, buffer.Length, flags); return Send(buffer, 0, buffer.Length, flags);
} }
@ -211,7 +211,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, int start, int count) public int Send(byte[] buffer, int start, int count)
{ {
if (buffer == null) throw new ArgumentNullException("buffer"); if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
return Send(buffer, start, count, SocketFlags.None); return Send(buffer, start, count, SocketFlags.None);
} }
@ -226,19 +226,19 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(byte[] buffer, int start, int count, SocketFlags flags) public int Send(byte[] buffer, int start, int count, SocketFlags flags)
{ {
if (buffer == null) throw new ArgumentNullException("buffer"); if (buffer == null) throw new ArgumentNullException("buffer");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
var totalBytesSent = 0; var totalBytesSent = 0;
var bytesRemaining = buffer.Length; var bytesRemaining = buffer.Length;
try try
{ {
if (this.Socket == null || this.Socket.Available < 0) throw new Exception("socket is null"); if (Socket == null || Socket.Available < 0) throw new Exception("socket is null");
lock (this.socketLock) lock (socketLock)
{ {
while (bytesRemaining > 0 && this.IsOpen() && !_closing) // Ensure we send every byte. while (bytesRemaining > 0 && IsOpen() && !_closing) // Ensure we send every byte.
{ {
int bytesSent = this._Send(buffer, totalBytesSent, bytesRemaining, flags); int bytesSent = _Send(buffer, totalBytesSent, bytesRemaining, flags);
if (bytesSent == 0) break; if (bytesSent == 0) break;
bytesRemaining -= bytesSent; bytesRemaining -= bytesSent;
@ -248,11 +248,11 @@ using (var socketEventargs = new SocketAsyncEventArgs())
} }
catch (SocketException) catch (SocketException)
{ {
this.Disconnect(); Disconnect();
} }
catch (Exception e) catch (Exception e)
{ {
this.Disconnect(); Disconnect();
Logger.WarnException(e, "Send"); Logger.WarnException(e, "Send");
} }
@ -267,7 +267,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(IEnumerable<byte> data) public int Send(IEnumerable<byte> data)
{ {
if (data == null) throw new ArgumentNullException("data"); if (data == null) throw new ArgumentNullException("data");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
return Send(data, SocketFlags.None); return Send(data, SocketFlags.None);
} }
@ -280,7 +280,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
public int Send(IEnumerable<byte> data, SocketFlags flags) public int Send(IEnumerable<byte> data, SocketFlags flags)
{ {
if (data == null) throw new ArgumentNullException("data"); if (data == null) throw new ArgumentNullException("data");
if (!this.IsOpen()) return 0; if (!IsOpen()) return 0;
var buffer = data.ToArray(); var buffer = data.ToArray();
return Send(buffer, 0, buffer.Length, SocketFlags.None); return Send(buffer, 0, buffer.Length, SocketFlags.None);
} }
@ -297,14 +297,14 @@ using (var socketEventargs = new SocketAsyncEventArgs())
Task.Run(() => { Task.Run(() => {
try try
{ {
this.Server.OnClientDisconnect(new ConnectionEventArgs(this)); Server.OnClientDisconnect(new ConnectionEventArgs(this));
if (this.Socket != null) if (Socket != null)
{ {
try try
{ {
this.Socket.Shutdown(SocketShutdown.Both); Socket.Shutdown(SocketShutdown.Both);
this.Socket.Close(); Socket.Close();
this.Socket = null; Socket = null;
} }
catch (Exception) catch (Exception)
{ {
@ -324,7 +324,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
{ {
get get
{ {
return (this.Client is BattleClient); return (Client is BattleClient);
} }
} }
@ -333,7 +333,7 @@ using (var socketEventargs = new SocketAsyncEventArgs())
_closed = true; _closed = true;
} }
public bool IsOpen() { return !_closed && this.Socket != null/* && (!this.IsMooNet || this.LastKeepAliveTick > (DateTime.Now.ToUnixTime() - 120U))*/; } public bool IsOpen() { return !_closed && Socket != null/* && (!this.IsMooNet || this.LastKeepAliveTick > (DateTime.Now.ToUnixTime() - 120U))*/; }
public uint LastKeepAliveTick { get; set; } public uint LastKeepAliveTick { get; set; }
/// <summary> /// <summary>

View File

@ -18,7 +18,7 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
public ConnectionDataEventArgs(IConnection connection, IEnumerable<byte> data) public ConnectionDataEventArgs(IConnection connection, IEnumerable<byte> data)
: base(connection) : base(connection)
{ {
this.Data = data ?? new byte[0]; Data = data ?? new byte[0];
} }
public override string ToString() public override string ToString()

View File

@ -19,7 +19,7 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
{ {
if (connection == null) if (connection == null)
throw new ArgumentNullException("connection"); throw new ArgumentNullException("connection");
this.Connection = connection; Connection = connection;
} }
public override string ToString() public override string ToString()

View File

@ -41,11 +41,11 @@ namespace DiIiS_NA.GameServer.ClientSystem.Base
public virtual bool Listen(string bindIP, int port) public virtual bool Listen(string bindIP, int port)
{ {
// Check if the server has been disposed. // Check if the server has been disposed.
if (_disposed) throw new ObjectDisposedException(this.GetType().Name, "Server has been disposed."); if (_disposed) throw new ObjectDisposedException(GetType().Name, "Server has been disposed.");
// Check if the server is already listening. // Check if the server is already listening.
if (IsListening) throw new InvalidOperationException("Server is already listening."); if (IsListening) throw new InvalidOperationException("Server is already listening.");
this.Port = port; Port = port;
Acceptor = new AsyncAcceptor(); Acceptor = new AsyncAcceptor();
if (!Acceptor.Start(bindIP, port)) if (!Acceptor.Start(bindIP, port))

View File

@ -48,11 +48,11 @@ namespace DiIiS_NA.GameServer.ClientSystem
{ {
get get
{ {
return this._tickingEnabled; return _tickingEnabled;
} }
set set
{ {
this._tickingEnabled = value; _tickingEnabled = value;
//if (value == true) //if (value == true)
//this.SendTick(); //this.SendTick();
} }
@ -64,8 +64,8 @@ namespace DiIiS_NA.GameServer.ClientSystem
public GameClient(IConnection connection) public GameClient(IConnection connection)
{ {
this.TickingEnabled = false; TickingEnabled = false;
this.Connection = connection; Connection = connection;
_outgoingBuffer.WriteInt(32, 0); _outgoingBuffer.WriteInt(32, 0);
} }
@ -87,12 +87,12 @@ namespace DiIiS_NA.GameServer.ClientSystem
_incomingBuffer.AppendData(e.Data.ToArray()); _incomingBuffer.AppendData(e.Data.ToArray());
while (this.Connection.IsOpen() && _incomingBuffer.IsPacketAvailable()) while (Connection.IsOpen() && _incomingBuffer.IsPacketAvailable())
{ {
int end = _incomingBuffer.Position; int end = _incomingBuffer.Position;
end += _incomingBuffer.ReadInt(32) * 8; end += _incomingBuffer.ReadInt(32) * 8;
while ((end - _incomingBuffer.Position) >= 9 && this.Connection.IsOpen()) while ((end - _incomingBuffer.Position) >= 9 && Connection.IsOpen())
{ {
var message = _incomingBuffer.ParseMessage(); var message = _incomingBuffer.ParseMessage();
//217 //217
@ -106,7 +106,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
if (message.Consumer != Consumers.None) if (message.Consumer != Consumers.None)
{ {
if (message.Consumer == Consumers.ClientManager) ClientManager.Instance.Consume(this, message); // Client should be greeted by ClientManager and sent initial game-setup messages. if (message.Consumer == Consumers.ClientManager) ClientManager.Instance.Consume(this, message); // Client should be greeted by ClientManager and sent initial game-setup messages.
else this.Game.Route(this, message); else Game.Route(this, message);
} }
else if (message is ISelfHandler) (message as ISelfHandler).Handle(this); // if message is able to handle itself, let it do so. else if (message is ISelfHandler) (message as ISelfHandler).Handle(this); // if message is able to handle itself, let it do so.
@ -143,9 +143,9 @@ namespace DiIiS_NA.GameServer.ClientSystem
public virtual void SendMessage(GameMessage message) public virtual void SendMessage(GameMessage message)
{ {
//System.Threading.Thread.Sleep(50); //System.Threading.Thread.Sleep(50);
lock (this._outgoingBuffer) lock (_outgoingBuffer)
{ {
if (this.Game.TickCounter > this.LastReplicatedTick && this.TickingEnabled && !(message is GameTickMessage) /*&& !(message is EndOfTickMessage)*/ && !this.Player.BetweenWorlds) if (Game.TickCounter > LastReplicatedTick && TickingEnabled && !(message is GameTickMessage) /*&& !(message is EndOfTickMessage)*/ && !Player.BetweenWorlds)
{ {
/*var endMessage = new EndOfTickMessage() /*var endMessage = new EndOfTickMessage()
{ {
@ -156,8 +156,8 @@ namespace DiIiS_NA.GameServer.ClientSystem
_outgoingBuffer.EncodeMessage(endMessage); _outgoingBuffer.EncodeMessage(endMessage);
Connection.Send(_outgoingBuffer.GetPacketAndReset());*/ Connection.Send(_outgoingBuffer.GetPacketAndReset());*/
this.LastReplicatedTick = this.Game.TickCounter; LastReplicatedTick = Game.TickCounter;
var tickMessage = new GameTickMessage(this.Game.TickCounter); var tickMessage = new GameTickMessage(Game.TickCounter);
Logger.LogOutgoingPacket(tickMessage); Logger.LogOutgoingPacket(tickMessage);
_outgoingBuffer.EncodeMessage(tickMessage); _outgoingBuffer.EncodeMessage(tickMessage);
Connection.Send(_outgoingBuffer.GetPacketAndReset()); Connection.Send(_outgoingBuffer.GetPacketAndReset());
@ -168,7 +168,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
Logger.LogOutgoingPacket(message); Logger.LogOutgoingPacket(message);
_outgoingBuffer.EncodeMessage(message); // change ConsoleTarget's level to Level.Dump in program.cs if u want to see messages on console. _outgoingBuffer.EncodeMessage(message); // change ConsoleTarget's level to Level.Dump in program.cs if u want to see messages on console.
if (this.TickingEnabled) if (TickingEnabled)
{ {
var data = _outgoingBuffer.GetPacketAndReset(); var data = _outgoingBuffer.GetPacketAndReset();
Connection.Send(data); Connection.Send(data);
@ -190,19 +190,19 @@ namespace DiIiS_NA.GameServer.ClientSystem
public void SendTick() public void SendTick()
{ {
//if (_outgoingBuffer.Length <= 32) return; //if (_outgoingBuffer.Length <= 32) return;
lock (this._outgoingBuffer) lock (_outgoingBuffer)
{ {
if (!dataSent) return; if (!dataSent) return;
if (this.TickingEnabled && this.Game.TickCounter > this.LastReplicatedTick) if (TickingEnabled && Game.TickCounter > LastReplicatedTick)
{ {
/*this.SendMessage(new EndOfTickMessage() /*this.SendMessage(new EndOfTickMessage()
{ {
Field0 = this.Game.TickCounter, Field0 = this.Game.TickCounter,
Field1 = this.LastReplicatedTick Field1 = this.LastReplicatedTick
}); // send the tick end.*/ }); // send the tick end.*/
this.SendMessage(new GameTickMessage(this.Game.TickCounter)); // send the tick. SendMessage(new GameTickMessage(Game.TickCounter)); // send the tick.
this.LastReplicatedTick = this.Game.TickCounter; LastReplicatedTick = Game.TickCounter;
//this.SendMessage(new GameTickMessage(0)); //before client enters game causes freeze with PvP scoreboard //this.SendMessage(new GameTickMessage(0)); //before client enters game causes freeze with PvP scoreboard
/*this.SendMessage(new EndOfTickMessage() /*this.SendMessage(new EndOfTickMessage()
{ {
@ -210,14 +210,14 @@ namespace DiIiS_NA.GameServer.ClientSystem
Field1 = 0 Field1 = 0
}); // send the tick end*/ }); // send the tick end*/
dataSent = false; dataSent = false;
this.FlushOutgoingBuffer(); FlushOutgoingBuffer();
} }
} }
} }
public virtual void FlushOutgoingBuffer() public virtual void FlushOutgoingBuffer()
{ {
lock (this._outgoingBuffer) lock (_outgoingBuffer)
{ {
if (_outgoingBuffer.Length <= 32) return; if (_outgoingBuffer.Length <= 32) return;

View File

@ -28,9 +28,9 @@ namespace DiIiS_NA.GameServer.ClientSystem
public Bot DiscordBot { get; set; } public Bot DiscordBot { get; set; }
public GameServer() public GameServer()
{ {
this.OnConnect += ClientManager.Instance.OnConnect; OnConnect += ClientManager.Instance.OnConnect;
this.OnDisconnect += ClientManager.Instance.OnDisconnect; OnDisconnect += ClientManager.Instance.OnDisconnect;
this.DataReceived += GameServer_DataReceived; DataReceived += GameServer_DataReceived;
} }
void GameServer_DataReceived(object sender, ConnectionDataEventArgs e) void GameServer_DataReceived(object sender, ConnectionDataEventArgs e)
@ -43,7 +43,7 @@ namespace DiIiS_NA.GameServer.ClientSystem
{ {
int Port = 2001; int Port = 2001;
if (!this.Listen(Program.GAMESERVERIP, Port)) return; if (!Listen(Program.GAMESERVERIP, Port)) return;
Logger.Info("Game Server Started - {0}:{1}...", Program.GAMESERVERIP, Port); Logger.Info("Game Server Started - {0}:{1}...", Program.GAMESERVERIP, Port);
} }
} }

View File

@ -33,9 +33,9 @@ namespace DiIiS_NA.GameServer.CommandManager
public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.Admin) public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.Admin)
{ {
this.Name = name.ToLower(); Name = name.ToLower();
this.Help = help; Help = help;
this.MinUserLevel = minUserLevel; MinUserLevel = minUserLevel;
} }
} }
@ -59,9 +59,9 @@ namespace DiIiS_NA.GameServer.CommandManager
public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User) public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
{ {
this.Name = command.ToLower(); Name = command.ToLower();
this.Help = help; Help = help;
this.MinUserLevel = minUserLevel; MinUserLevel = minUserLevel;
} }
} }

View File

@ -28,14 +28,14 @@ namespace DiIiS_NA.GameServer.CommandManager
public void Register(CommandGroupAttribute attributes) public void Register(CommandGroupAttribute attributes)
{ {
this.Attributes = attributes; Attributes = attributes;
this.RegisterDefaultCommand(); RegisterDefaultCommand();
this.RegisterCommands(); RegisterCommands();
} }
private void RegisterCommands() private void RegisterCommands()
{ {
foreach (var method in this.GetType().GetMethods()) foreach (var method in GetType().GetMethods())
{ {
object[] attributes = method.GetCustomAttributes(typeof(CommandAttribute), true); object[] attributes = method.GetCustomAttributes(typeof(CommandAttribute), true);
if (attributes.Length == 0) continue; if (attributes.Length == 0) continue;
@ -43,8 +43,8 @@ namespace DiIiS_NA.GameServer.CommandManager
var attribute = (CommandAttribute)attributes[0]; var attribute = (CommandAttribute)attributes[0];
if (attribute is DefaultCommand) continue; if (attribute is DefaultCommand) continue;
if (!this._commands.ContainsKey(attribute)) if (!_commands.ContainsKey(attribute))
this._commands.Add(attribute, method); _commands.Add(attribute, method);
else else
Logger.Warn("There exists an already registered command '{0}'.", attribute.Name); Logger.Warn("There exists an already registered command '{0}'.", attribute.Name);
} }
@ -52,38 +52,38 @@ namespace DiIiS_NA.GameServer.CommandManager
private void RegisterDefaultCommand() private void RegisterDefaultCommand()
{ {
foreach (var method in this.GetType().GetMethods()) foreach (var method in GetType().GetMethods())
{ {
object[] attributes = method.GetCustomAttributes(typeof(DefaultCommand), true); object[] attributes = method.GetCustomAttributes(typeof(DefaultCommand), true);
if (attributes.Length == 0) continue; if (attributes.Length == 0) continue;
if (method.Name.ToLower() == "fallback") continue; if (method.Name.ToLower() == "fallback") continue;
this._commands.Add(new DefaultCommand(this.Attributes.MinUserLevel), method); _commands.Add(new DefaultCommand(Attributes.MinUserLevel), method);
return; return;
} }
// set the fallback command if we couldn't find a defined DefaultCommand. // set the fallback command if we couldn't find a defined DefaultCommand.
this._commands.Add(new DefaultCommand(this.Attributes.MinUserLevel), this.GetType().GetMethod("Fallback")); _commands.Add(new DefaultCommand(Attributes.MinUserLevel), GetType().GetMethod("Fallback"));
} }
public virtual string Handle(string parameters, BattleClient invokerClient = null) public virtual string Handle(string parameters, BattleClient invokerClient = null)
{ {
// check if the user has enough privileges to access command group. // check if the user has enough privileges to access command group.
// check if the user has enough privileges to invoke the command. // check if the user has enough privileges to invoke the command.
if (invokerClient != null && this.Attributes.MinUserLevel > invokerClient.Account.UserLevel) if (invokerClient != null && Attributes.MinUserLevel > invokerClient.Account.UserLevel)
return "You don't have enough privileges to invoke that command."; return "You don't have enough privileges to invoke that command.";
string[] @params = null; string[] @params = null;
CommandAttribute target = null; CommandAttribute target = null;
if (parameters == string.Empty) if (parameters == string.Empty)
target = this.GetDefaultSubcommand(); target = GetDefaultSubcommand();
else else
{ {
@params = parameters.Split(' '); @params = parameters.Split(' ');
target = this.GetSubcommand(@params[0]) ?? this.GetDefaultSubcommand(); target = GetSubcommand(@params[0]) ?? GetDefaultSubcommand();
if (target != this.GetDefaultSubcommand()) if (target != GetDefaultSubcommand())
@params = @params.Skip(1).ToArray(); @params = @params.Skip(1).ToArray();
} }
@ -91,12 +91,12 @@ namespace DiIiS_NA.GameServer.CommandManager
if (invokerClient != null && target.MinUserLevel > invokerClient.Account.UserLevel) if (invokerClient != null && target.MinUserLevel > invokerClient.Account.UserLevel)
return "You don't have enough privileges to invoke that command."; return "You don't have enough privileges to invoke that command.";
return (string)this._commands[target].Invoke(this, new object[] { @params, invokerClient }); return (string)_commands[target].Invoke(this, new object[] { @params, invokerClient });
} }
public string GetHelp(string command) public string GetHelp(string command)
{ {
foreach (var pair in this._commands) foreach (var pair in _commands)
{ {
if (command != pair.Key.Name) continue; if (command != pair.Key.Name) continue;
return pair.Key.Help; return pair.Key.Help;
@ -109,7 +109,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public virtual string Fallback(string[] @params = null, BattleClient invokerClient = null) public virtual string Fallback(string[] @params = null, BattleClient invokerClient = null)
{ {
var output = "Available subcommands: "; var output = "Available subcommands: ";
foreach (var pair in this._commands) foreach (var pair in _commands)
{ {
if (pair.Key.Name.Trim() == string.Empty) continue; // skip fallback command. if (pair.Key.Name.Trim() == string.Empty) continue; // skip fallback command.
if (invokerClient != null && pair.Key.MinUserLevel > invokerClient.Account.UserLevel) continue; if (invokerClient != null && pair.Key.MinUserLevel > invokerClient.Account.UserLevel) continue;
@ -121,12 +121,12 @@ namespace DiIiS_NA.GameServer.CommandManager
protected CommandAttribute GetDefaultSubcommand() protected CommandAttribute GetDefaultSubcommand()
{ {
return this._commands.Keys.First(); return _commands.Keys.First();
} }
protected CommandAttribute GetSubcommand(string name) protected CommandAttribute GetSubcommand(string name)
{ {
return this._commands.Keys.FirstOrDefault(command => command.Name == name); return _commands.Keys.FirstOrDefault(command => command.Name == name);
} }
} }
} }

View File

@ -171,7 +171,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public override string Handle(string parameters, BattleClient invokerClient = null) public override string Handle(string parameters, BattleClient invokerClient = null)
{ {
if (parameters == string.Empty) if (parameters == string.Empty)
return this.Fallback(); return Fallback();
string output = string.Empty; string output = string.Empty;
bool found = false; bool found = false;

View File

@ -13,7 +13,7 @@ namespace DiIiS_NA.GameServer.CommandManager
{ {
public sealed class Config : DiIiS_NA.Core.Config.Config public sealed class Config : DiIiS_NA.Core.Config.Config
{ {
public char CommandPrefix { get { return this.GetString("CommandPrefix", "!")[0]; } set { this.Set("CommandPrefix", value); } } public char CommandPrefix { get { return GetString("CommandPrefix", "!")[0]; } set { Set("CommandPrefix", value); } }
private static readonly Config _instance = new Config(); private static readonly Config _instance = new Config();
public static Config Instance { get { return _instance; } } public static Config Instance { get { return _instance; } }

View File

@ -347,7 +347,7 @@ namespace DiIiS_NA.GameServer.CommandManager
if (@params == null) if (@params == null)
return this.Fallback(); return Fallback();
name = @params[0]; name = @params[0];
@ -487,7 +487,7 @@ namespace DiIiS_NA.GameServer.CommandManager
if (invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(levelArea)) //EnterLevelArea if (invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(levelArea)) //EnterLevelArea
{ {
var trigger = invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers[levelArea]; var trigger = invokerClient.InGameClient.Player.World.Game.SideQuestProgress.GlobalQuestTriggers[levelArea];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea) if (trigger.triggerType == QuestStepObjectiveType.EnterLevelArea)
{ {
try try
{ {
@ -628,7 +628,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Event(string[] @params, BattleClient invokerClient) public string Event(string[] @params, BattleClient invokerClient)
{ {
if (@params == null) if (@params == null)
return this.Fallback(); return Fallback();
if (@params.Count() != 1) if (@params.Count() != 1)
return "Invalid arguments. Type 'help text public' to get help."; return "Invalid arguments. Type 'help text public' to get help.";
@ -650,7 +650,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Timer(string[] @params, BattleClient invokerClient) public string Timer(string[] @params, BattleClient invokerClient)
{ {
if (@params == null) if (@params == null)
return this.Fallback(); return Fallback();
if (@params.Count() != 2) if (@params.Count() != 2)
return "Invalid arguments. Type 'help text public' to get help."; return "Invalid arguments. Type 'help text public' to get help.";
@ -671,7 +671,7 @@ namespace DiIiS_NA.GameServer.CommandManager
public string Search(string[] @params, BattleClient invokerClient) public string Search(string[] @params, BattleClient invokerClient)
{ {
if (@params == null) if (@params == null)
return this.Fallback(); return Fallback();
var matches = new List<Asset>(); var matches = new List<Asset>();
@ -817,7 +817,7 @@ namespace DiIiS_NA.GameServer.CommandManager
} }
return matches.Aggregate(matches.Count >= 1 ? "World Matches:\n" : "No match found.", return matches.Aggregate(matches.Count >= 1 ? "World Matches:\n" : "No match found.",
(current, match) => current + string.Format("[{0}] {1} - {2}\n", match.SNOId.ToString("D6"), match.Name, (match.Data as DiIiS_NA.Core.MPQ.FileFormats.World).DynamicWorld)); (current, match) => current + string.Format("[{0}] {1} - {2}\n", match.SNOId.ToString("D6"), match.Name, (match.Data as World).DynamicWorld));
} }
[Command("qr", "Show QuestRange of an actor.\nUsage: lookup qr <id>")] [Command("qr", "Show QuestRange of an actor.\nUsage: lookup qr <id>")]

View File

@ -13,27 +13,96 @@ namespace DiIiS_NA.GameServer
{ {
public sealed class Config : DiIiS_NA.Core.Config.Config public sealed class Config : DiIiS_NA.Core.Config.Config
{ {
public bool Enabled { get { return this.GetBoolean("Enabled", true); } set { this.Set("Enabled", value); } } public bool Enabled
public string BindIP { get { return this.GetString("BindIP", "127.0.0.1"); } set { this.Set("BindIP", value); } } {
public int WebPort { get { return this.GetInt("WebPort", 9001); } set { this.Set("WebPort", value); } } get => GetBoolean("Enabled", true);
public int Port { get { return this.GetInt("Port", 1345); } set { this.Set("Port", value); } } set => Set("Enabled", value);
public string BindIPv6 { get { return this.GetString("BindIPv6", "::1"); } set { this.Set("BindIPv6", value); } } }
public bool DRLGemu { get { return this.GetBoolean("DRLGemu", true); } set { this.Set("DRLGemu", value); } }
public bool CoreActive { get { return this.GetBoolean("CoreActive", true); } set { this.Set("CoreActive", value); } } public string BindIP
{
get => GetString("BindIP", "127.0.0.1");
set => Set("BindIP", value);
}
public int WebPort
{
get => GetInt("WebPort", 9001);
set => Set("WebPort", value);
}
public int Port
{
get => GetInt("Port", 1345);
set => Set("Port", value);
}
public string BindIPv6
{
get => GetString("BindIPv6", "::1");
set => Set("BindIPv6", value);
}
public bool DRLGemu
{
get => GetBoolean("DRLGemu", true);
set => Set("DRLGemu", value);
}
public bool CoreActive
{
get => GetBoolean("CoreActive", true);
set => Set("CoreActive", value);
}
//Modding of Game-Server //Modding of Game-Server
public float RateEXP { get { return this.GetFloat("RateExp", 1); } set { this.Set("RateExp", value); } } public float RateEXP
public float RateMoney { get { return this.GetFloat("RateMoney", 1); } set { this.Set("RateMoney", value); } } {
public float RateDrop { get { return this.GetFloat("RateDrop", 1); } set { this.Set("RateDrop", value); } } get => GetFloat("RateExp", 1);
public float RateChangeDrop { get { return this.GetFloat("RateChangeDrop", 1); } set { this.Set("RateChangeDrop", value); } } set => Set("RateExp", value);
public float RateMonsterHP { get { return this.GetFloat("RateMonsterHP", 1); } set { this.Set("RateMonsterHP", value); } } }
public float RateMonsterDMG { get { return this.GetFloat("RateMonsterHP", 1); } set { this.Set("RateMonsterHP", value); } }
public float RateMoney
{
get => GetFloat("RateMoney", 1);
set => Set("RateMoney", value);
}
public float RateDrop
{
get => GetFloat("RateDrop", 1);
set => Set("RateDrop", value);
}
public float RateChangeDrop
{
get => GetFloat("RateChangeDrop", 1);
set => Set("RateChangeDrop", value);
}
public float RateMonsterHP
{
get => GetFloat("RateMonsterHP", 1);
set => Set("RateMonsterHP", value);
}
public float RateMonsterDMG
{
get => GetFloat("RateMonsterHP", 1);
set => Set("RateMonsterHP", value);
}
public bool IWServer { get { return this.GetBoolean("IWServer", true); } set { this.Set("IWServer", value); } } public bool IWServer
{
get => GetBoolean("IWServer", true);
set => Set("IWServer", value);
}
private static readonly Config _instance = new Config(); public static Config Instance { get; } = new();
public static Config Instance { get { return _instance; } }
private Config() : base("Game-Server") { } private Config() : base("Game-Server")
{
}
} }
} }

View File

@ -45,10 +45,10 @@ namespace DiIiS_NA.GameServer.Core
public InventoryGrid(Actor owner, int rows, int columns, int slot = 0) public InventoryGrid(Actor owner, int rows, int columns, int slot = 0)
{ {
this._backpack = new uint[rows, columns]; _backpack = new uint[rows, columns];
this._owner = owner; _owner = owner;
this.Items = new Dictionary<uint, Item>(); Items = new Dictionary<uint, Item>();
this.EquipmentSlot = slot; EquipmentSlot = slot;
} }
public void ResizeGrid(int rows, int columns) public void ResizeGrid(int rows, int columns)
@ -63,7 +63,7 @@ namespace DiIiS_NA.GameServer.Core
Items.Clear(); Items.Clear();
int r = Rows; int r = Rows;
int c = Columns; int c = Columns;
this._backpack = new uint[r, c]; _backpack = new uint[r, c];
} }
// This should be in the database# // This should be in the database#
@ -165,13 +165,13 @@ namespace DiIiS_NA.GameServer.Core
} }
} }
foreach (var plr in this._owner.World.Players.Values) foreach (var plr in _owner.World.Players.Values)
item.Unreveal(plr); item.Unreveal(plr);
} }
public bool HaveEnough(int GBid, int count) public bool HaveEnough(int GBid, int count)
{ {
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList(); List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int have = 0; int have = 0;
foreach (var itm in baseItems) foreach (var itm in baseItems)
have += itm.Attributes[GameAttribute.ItemStackQuantityLo]; have += itm.Attributes[GameAttribute.ItemStackQuantityLo];
@ -183,7 +183,7 @@ namespace DiIiS_NA.GameServer.Core
public int TotalItemCount(int GBid) public int TotalItemCount(int GBid)
{ {
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList(); List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int have = 0; int have = 0;
foreach (var itm in baseItems) foreach (var itm in baseItems)
have += itm.Attributes[GameAttribute.ItemStackQuantityLo]; have += itm.Attributes[GameAttribute.ItemStackQuantityLo];
@ -193,7 +193,7 @@ namespace DiIiS_NA.GameServer.Core
public void GrabSomeItems(int GBid, int count) //only for stackable! public void GrabSomeItems(int GBid, int count) //only for stackable!
{ {
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList(); List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == GBid).ToList();
int estimate = count; int estimate = count;
List<Item> consumed = new List<Item>(); List<Item> consumed = new List<Item>();
foreach (var itm in baseItems) foreach (var itm in baseItems)
@ -211,7 +211,7 @@ namespace DiIiS_NA.GameServer.Core
} }
foreach (var itm in consumed) foreach (var itm in consumed)
{ {
this.RemoveItem(itm); RemoveItem(itm);
itm.Unreveal(itm.Owner as Player); itm.Unreveal(itm.Owner as Player);
//itm.Destroy(); //itm.Destroy();
} }
@ -267,7 +267,7 @@ namespace DiIiS_NA.GameServer.Core
if (item.IsStackable() && _owner is Player) if (item.IsStackable() && _owner is Player)
{ {
// Find items of same type (GBID) and try to add it to one of them // Find items of same type (GBID) and try to add it to one of them
List<Item> baseItems = this.Items.Values.Where(i => i.GBHandle.GBID == item.GBHandle.GBID).ToList(); List<Item> baseItems = Items.Values.Where(i => i.GBHandle.GBID == item.GBHandle.GBID).ToList();
foreach (Item baseItem in baseItems) foreach (Item baseItem in baseItems)
{ {
if (baseItem.Attributes[GameAttribute.ItemStackQuantityLo] + item.Attributes[GameAttribute.ItemStackQuantityLo] <= baseItem.ItemDefinition.MaxStackSize) if (baseItem.Attributes[GameAttribute.ItemStackQuantityLo] + item.Attributes[GameAttribute.ItemStackQuantityLo] <= baseItem.ItemDefinition.MaxStackSize)
@ -361,7 +361,7 @@ namespace DiIiS_NA.GameServer.Core
{ {
if (GetItemInventorySize(item).Height > 1) if (GetItemInventorySize(item).Height > 1)
{ {
if (this.EquipmentSlot == 0 && row > 4) return false; if (EquipmentSlot == 0 && row > 4) return false;
bool a = (_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID); bool a = (_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID);
bool b = (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID); bool b = (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID);
if (!((_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID) && (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID))) if (!((_backpack[row, column] == 0 || _backpack[row, column] == item.GlobalID) && (_backpack[row + 1, column] == 0 || _backpack[row + 1, column] == item.GlobalID)))
@ -410,7 +410,7 @@ namespace DiIiS_NA.GameServer.Core
public Item GetItem(int row, int column) public Item GetItem(int row, int column)
{ {
return this.GetItem(_backpack[row, column]); return GetItem(_backpack[row, column]);
} }
public bool Reveal(Player player) public bool Reveal(Player player)
@ -445,8 +445,8 @@ namespace DiIiS_NA.GameServer.Core
public Item GetItemByDynId(Player plr, uint dynId) public Item GetItemByDynId(Player plr, uint dynId)
{ {
if (this.Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0) if (Items.Values.Where(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId).Count() > 0)
return this.Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId); return Items.Values.Single(it => it.IsRevealedToPlayer(plr) && it.DynamicID(plr) == dynId);
else else
return null; return null;
} }

View File

@ -36,8 +36,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
/// <param name="stream">The MPQFileStream to read from.</param> /// <param name="stream">The MPQFileStream to read from.</param>
public AABB(MpqFileStream stream) public AABB(MpqFileStream stream)
{ {
this.Min = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); Min = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
this.Max = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); Max = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
} }
/// <summary> /// <summary>
@ -64,8 +64,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public bool IsWithin(Vector3D v) public bool IsWithin(Vector3D v)
{ {
if (v >= this.Min && if (v >= Min &&
v <= this.Max) v <= Max)
{ {
return true; return true;
} }
@ -75,13 +75,13 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public bool Intersects(AABB other) public bool Intersects(AABB other)
{ {
if (// Max < o.Min if (// Max < o.Min
this.Max.X < other.Min.X || Max.X < other.Min.X ||
this.Max.Y < other.Min.Y || Max.Y < other.Min.Y ||
this.Max.Z < other.Min.Z || Max.Z < other.Min.Z ||
// Min > o.Max // Min > o.Max
this.Min.X > other.Max.X || Min.X > other.Max.X ||
this.Min.Y > other.Max.Y || Min.Y > other.Max.Y ||
this.Min.Z > other.Max.Z) Min.Z > other.Max.Z)
{ {
return false; return false;
} }
@ -102,7 +102,7 @@ namespace DiIiS_NA.GameServer.Core.Types.Collision
public override string ToString() public override string ToString()
{ {
return string.Format("AABB: min:{0} max:{1}", this.Min, this.Max); return string.Format("AABB: min:{0} max:{1}", Min, Max);
} }
} }
} }

View File

@ -22,8 +22,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Quaternion(Vector3D V, float inW) public Quaternion(Vector3D V, float inW)
{ {
this.Vector3D = V; Vector3D = V;
this.W = inW; W = inW;
} }
/// <summary> /// <summary>
/// Creates an quaternion that rotates along the Z-axis by the specified "facing" angle. /// Creates an quaternion that rotates along the Z-axis by the specified "facing" angle.
@ -45,8 +45,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
/// <param name="stream">The MPQFileStream to read from.</param> /// <param name="stream">The MPQFileStream to read from.</param>
public Quaternion(MpqFileStream stream) public Quaternion(MpqFileStream stream)
{ {
this.Vector3D = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); Vector3D = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
this.W = stream.ReadValueF32(); W = stream.ReadValueF32();
} }
/// <summary> /// <summary>

View File

@ -33,8 +33,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector2D(int x, int y) public Vector2D(int x, int y)
{ {
this.X = x; X = x;
this.Y = y; Y = y;
} }
/// <summary> /// <summary>

View File

@ -36,25 +36,25 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector2F(float x, float y) public Vector2F(float x, float y)
{ {
this.X = x; X = x;
this.Y = y; Y = y;
} }
public Vector2F(float value) public Vector2F(float value)
{ {
this.X = this.Y = value; X = Y = value;
} }
public override string ToString() public override string ToString()
{ {
CultureInfo currentCulture = CultureInfo.CurrentCulture; CultureInfo currentCulture = CultureInfo.CurrentCulture;
return string.Format(currentCulture, "{{X:{0} Y:{1}}}", return string.Format(currentCulture, "{{X:{0} Y:{1}}}",
new object[] { this.X.ToString(currentCulture), this.Y.ToString(currentCulture) }); new object[] { X.ToString(currentCulture), Y.ToString(currentCulture) });
} }
public bool Equals(Vector2F other) public bool Equals(Vector2F other)
{ {
return ((this.X == other.X) && (this.Y == other.Y)); return ((X == other.X) && (Y == other.Y));
} }
public override bool Equals(object obj) public override bool Equals(object obj)
@ -62,25 +62,25 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
bool flag = false; bool flag = false;
if (obj is Vector2F) if (obj is Vector2F)
{ {
flag = this.Equals((Vector2F)obj); flag = Equals((Vector2F)obj);
} }
return flag; return flag;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return (this.X.GetHashCode() + this.Y.GetHashCode()); return (X.GetHashCode() + Y.GetHashCode());
} }
public float Length() public float Length()
{ {
float num = (this.X * this.X) + (this.Y * this.Y); float num = (X * X) + (Y * Y);
return (float)System.Math.Sqrt((double)num); return (float)System.Math.Sqrt((double)num);
} }
public float LengthSquared() public float LengthSquared()
{ {
return ((this.X * this.X) + (this.Y * this.Y)); return ((X * X) + (Y * Y));
} }
public static float Distance(Vector2F value1, Vector2F value2) public static float Distance(Vector2F value1, Vector2F value2)
@ -125,10 +125,10 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public void Normalize() public void Normalize()
{ {
float num2 = (this.X * this.X) + (this.Y * this.Y); float num2 = (X * X) + (Y * Y);
float num = 1f / ((float)System.Math.Sqrt((double)num2)); float num = 1f / ((float)System.Math.Sqrt((double)num2));
this.X *= num; X *= num;
this.Y *= num; Y *= num;
} }
public static Vector2F Normalize(Vector2F value) public static Vector2F Normalize(Vector2F value)
@ -166,7 +166,7 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
/// <returns></returns> /// <returns></returns>
public float Rotation() public float Rotation()
{ {
return Angle(Vector2F.UnitY) > Angle(-Vector2F.UnitY) ? -Angle(Vector2F.UnitX) : Angle(Vector2F.UnitX); return Angle(UnitY) > Angle(-UnitY) ? -Angle(UnitX) : Angle(UnitX);
} }

View File

@ -24,16 +24,16 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public Vector3D() public Vector3D()
{ {
this.X = 0; X = 0;
this.Y = 0; Y = 0;
this.Z = 0; Z = 0;
} }
public Vector3D(Vector3D vector) public Vector3D(Vector3D vector)
{ {
this.X = vector.X; X = vector.X;
this.Y = vector.Y; Y = vector.Y;
this.Z = vector.Z; Z = vector.Z;
} }
public Vector3D(float x, float y, float z) public Vector3D(float x, float y, float z)
@ -97,9 +97,9 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public void Set(float x, float y, float z) public void Set(float x, float y, float z)
{ {
this.X = x; X = x;
this.Y = y; Y = y;
this.Z = z; Z = z;
} }
/// <summary> /// <summary>
@ -118,8 +118,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator ==(Vector3D a, Vector3D b) public static bool operator ==(Vector3D a, Vector3D b)
{ {
if (object.ReferenceEquals(null, a)) if (ReferenceEquals(null, a))
return object.ReferenceEquals(null, b); return ReferenceEquals(null, b);
return a.Equals(b); return a.Equals(b);
} }
@ -130,8 +130,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator >(Vector3D a, Vector3D b) public static bool operator >(Vector3D a, Vector3D b)
{ {
if (object.ReferenceEquals(null, a)) if (ReferenceEquals(null, a))
return !object.ReferenceEquals(null, b); return !ReferenceEquals(null, b);
return a.X > b.X return a.X > b.X
&& a.Y > b.Y && a.Y > b.Y
&& a.Z > b.Z; && a.Z > b.Z;
@ -154,8 +154,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator >=(Vector3D a, Vector3D b) public static bool operator >=(Vector3D a, Vector3D b)
{ {
if (object.ReferenceEquals(null, a)) if (ReferenceEquals(null, a))
return object.ReferenceEquals(null, b); return ReferenceEquals(null, b);
return a.X >= b.X return a.X >= b.X
&& a.Y >= b.Y && a.Y >= b.Y
&& a.Z >= b.Z; && a.Z >= b.Z;
@ -163,8 +163,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public static bool operator <=(Vector3D a, Vector3D b) public static bool operator <=(Vector3D a, Vector3D b)
{ {
if (object.ReferenceEquals(null, a)) if (ReferenceEquals(null, a))
return object.ReferenceEquals(null, b); return ReferenceEquals(null, b);
return a.X <= b.X return a.X <= b.X
&& a.Y <= b.Y && a.Y <= b.Y
&& a.Z <= b.Z; && a.Z <= b.Z;
@ -172,14 +172,14 @@ namespace DiIiS_NA.GameServer.Core.Types.Math
public override bool Equals(object o) public override bool Equals(object o)
{ {
if (object.ReferenceEquals(this, o)) if (ReferenceEquals(this, o))
return true; return true;
var v = o as Vector3D; var v = o as Vector3D;
if (v != null) if (v != null)
{ {
return this.X == v.X return X == v.X
&& this.Y == v.Y && Y == v.Y
&& this.Z == v.Z; && Z == v.Z;
} }
return false; return false;
} }

View File

@ -22,8 +22,8 @@ namespace DiIiS_NA.GameServer.Core.Types.Misc
/// </summary> /// </summary>
public Circle(Vector2F position, float radius) public Circle(Vector2F position, float radius)
{ {
this.Center = position; Center = position;
this.Radius = radius; Radius = radius;
} }
/// <summary> /// <summary>
@ -40,31 +40,31 @@ namespace DiIiS_NA.GameServer.Core.Types.Misc
public bool Intersects(Rectangle rectangle) public bool Intersects(Rectangle rectangle)
{ {
// Find the closest point to the circle within the rectangle // Find the closest point to the circle within the rectangle
float closestX = Clamp(this.Center.X, (float)rectangle.Left, (float)rectangle.Right); float closestX = Clamp(Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(this.Center.Y, (float)rectangle.Top, (float)rectangle.Bottom); float closestY = Clamp(Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
// Calculate the distance between the circle's center and this closest point // Calculate the distance between the circle's center and this closest point
float distanceX = this.Center.X - closestX; float distanceX = Center.X - closestX;
float distanceY = this.Center.Y - closestY; float distanceY = Center.Y - closestY;
// If the distance is less than the circle's radius, an intersection occurs // If the distance is less than the circle's radius, an intersection occurs
float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY); float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY);
return distanceSquared < (this.Radius * this.Radius); return distanceSquared < (Radius * Radius);
} }
public bool Intersects(RectangleF rectangle) public bool Intersects(RectangleF rectangle)
{ {
// Find the closest point to the circle within the rectangle // Find the closest point to the circle within the rectangle
float closestX = Clamp(this.Center.X, (float)rectangle.Left, (float)rectangle.Right); float closestX = Clamp(Center.X, (float)rectangle.Left, (float)rectangle.Right);
float closestY = Clamp(this.Center.Y, (float)rectangle.Top, (float)rectangle.Bottom); float closestY = Clamp(Center.Y, (float)rectangle.Top, (float)rectangle.Bottom);
// Calculate the distance between the circle's center and this closest point // Calculate the distance between the circle's center and this closest point
float distanceX = this.Center.X - closestX; float distanceX = Center.X - closestX;
float distanceY = this.Center.Y - closestY; float distanceY = Center.Y - closestY;
// If the distance is less than the circle's radius, an intersection occurs // If the distance is less than the circle's radius, an intersection occurs
float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY); float distanceSquared = (distanceX * distanceX) + (distanceY * distanceY);
return distanceSquared < (this.Radius * this.Radius); return distanceSquared < (Radius * Radius);
} }
public static float Clamp(float value, float min, float max) public static float Clamp(float value, float min, float max)

View File

@ -43,9 +43,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
/// <param name="maximumObjectsPerLeaf">Maximum number of objects per left before it's forced to split into sub-quadrans.</param> /// <param name="maximumObjectsPerLeaf">Maximum number of objects per left before it's forced to split into sub-quadrans.</param>
public QuadTree(Size minimumLeafSize, int maximumObjectsPerLeaf) public QuadTree(Size minimumLeafSize, int maximumObjectsPerLeaf)
{ {
this.RootNode = null; RootNode = null;
this.MinimumLeafSize = minimumLeafSize; MinimumLeafSize = minimumLeafSize;
this.MaximumObjectsPerLeaf = maximumObjectsPerLeaf; MaximumObjectsPerLeaf = maximumObjectsPerLeaf;
} }
/// <summary> /// <summary>
@ -65,18 +65,18 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
@object.Bounds.Y + @object.Bounds.Height / 2); @object.Bounds.Y + @object.Bounds.Height / 2);
var rootOrigin = new PointF(center.X - rootSize.Width / 2, center.Y - rootSize.Height / 2); var rootOrigin = new PointF(center.X - rootSize.Width / 2, center.Y - rootSize.Height / 2);
this.RootNode = new QuadNode(new RectangleF(rootOrigin, rootSize)); RootNode = new QuadNode(new RectangleF(rootOrigin, rootSize));
} }
int cycle = 0; int cycle = 0;
while (!RootNode.Bounds.Contains(@object.Bounds)) while (!RootNode.Bounds.Contains(@object.Bounds))
// if root-node's bounds does not contain object, expand the root. // if root-node's bounds does not contain object, expand the root.
{ {
this.ExpandRoot(@object.Bounds); ExpandRoot(@object.Bounds);
cycle++; cycle++;
if (cycle > 5) break; if (cycle > 5) break;
} }
this.InsertNodeObject(RootNode, @object); // insert the object to rootNode. InsertNodeObject(RootNode, @object); // insert the object to rootNode.
} }
/// <summary> /// <summary>
@ -88,16 +88,16 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
public List<T> Query<T>(RectangleF bounds, bool includeHierarchy = false) where T : WorldObject public List<T> Query<T>(RectangleF bounds, bool includeHierarchy = false) where T : WorldObject
{ {
var results = new List<T>(); var results = new List<T>();
if (this.RootNode != null) if (RootNode != null)
this.Query(bounds, RootNode, results, includeHierarchy); Query(bounds, RootNode, results, includeHierarchy);
return results; return results;
} }
public List<T> Query<T>(Circle proximity, bool includeHierarchy = false) where T : WorldObject public List<T> Query<T>(Circle proximity, bool includeHierarchy = false) where T : WorldObject
{ {
var results = new List<T>(); var results = new List<T>();
if (this.RootNode != null) if (RootNode != null)
this.Query(proximity, RootNode, results, includeHierarchy); Query(proximity, RootNode, results, includeHierarchy);
return results; return results;
} }
@ -128,7 +128,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (QuadNode childNode in node.Nodes) // query child-nodes too. foreach (QuadNode childNode in node.Nodes) // query child-nodes too.
{ {
this.Query(bounds, childNode, results); Query(bounds, childNode, results);
} }
} }
@ -152,7 +152,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (QuadNode childNode in node.Nodes) // query child-nodes too. foreach (QuadNode childNode in node.Nodes) // query child-nodes too.
{ {
this.Query(proximity, childNode, results); Query(proximity, childNode, results);
} }
} }
@ -179,9 +179,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
var newRootBounds = new RectangleF((float)newX, (float)newY, RootNode.Bounds.Width * 2f, RootNode.Bounds.Height * 2f); var newRootBounds = new RectangleF((float)newX, (float)newY, RootNode.Bounds.Width * 2f, RootNode.Bounds.Height * 2f);
var newRoot = new QuadNode(newRootBounds); var newRoot = new QuadNode(newRootBounds);
this.SetupChildNodes(newRoot); SetupChildNodes(newRoot);
newRoot[rootDirection] = RootNode; newRoot[rootDirection] = RootNode;
this.RootNode = newRoot; RootNode = newRoot;
} }
/// <summary> /// <summary>
@ -197,9 +197,9 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
recursionLimit++; recursionLimit++;
if (recursionLimit >= 20) return; if (recursionLimit >= 20) return;
// If there's no child-nodes and when new object is insertedi if node's object count will be bigger then MaximumObjectsPerLeaf, force a split. // If there's no child-nodes and when new object is insertedi if node's object count will be bigger then MaximumObjectsPerLeaf, force a split.
if (!node.HasChildNodes() && node.ContainedObjects.Count + 1 > this.MaximumObjectsPerLeaf) if (!node.HasChildNodes() && node.ContainedObjects.Count + 1 > MaximumObjectsPerLeaf)
{ {
this.SetupChildNodes(node); SetupChildNodes(node);
var childObjects = new List<WorldObject>(node.ContainedObjects.Values); // node's child objects. var childObjects = new List<WorldObject>(node.ContainedObjects.Values); // node's child objects.
var childrenToRelocate = new List<WorldObject>(); // child object to be relocated. var childrenToRelocate = new List<WorldObject>(); // child object to be relocated.
@ -220,8 +220,8 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
foreach (WorldObject childObject in childrenToRelocate) // relocate the child objects we marked. foreach (WorldObject childObject in childrenToRelocate) // relocate the child objects we marked.
{ {
this.RemoveObjectFromNode(childObject); RemoveObjectFromNode(childObject);
this.InsertNodeObject(node, childObject, recursionLimit); InsertNodeObject(node, childObject, recursionLimit);
} }
} }
@ -234,11 +234,11 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
if (!childNode.Bounds.Contains(@object.Bounds)) if (!childNode.Bounds.Contains(@object.Bounds))
continue; continue;
this.InsertNodeObject(childNode, @object, recursionLimit); InsertNodeObject(childNode, @object, recursionLimit);
return; return;
} }
this.AddObjectToNode(node, @object); // add the object to current node. AddObjectToNode(node, @object); // add the object to current node.
} }
/// <summary> /// <summary>
@ -284,12 +284,12 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
private void ObjectPositionChanged(object sender, EventArgs e) private void ObjectPositionChanged(object sender, EventArgs e)
{ {
var @object = sender as WorldObject; var @object = sender as WorldObject;
if (@object == null || !this._objectToNodeLookup.ContainsKey(@object)) return; if (@object == null || !_objectToNodeLookup.ContainsKey(@object)) return;
QuadNode node = this._objectToNodeLookup[@object]; QuadNode node = _objectToNodeLookup[@object];
if (node.Bounds.Contains(@object.Bounds) && !node.HasChildNodes()) return; if (node.Bounds.Contains(@object.Bounds) && !node.HasChildNodes()) return;
this.RemoveObjectFromNode(@object); RemoveObjectFromNode(@object);
Insert(@object); Insert(@object);
if (node.Parent != null) if (node.Parent != null)
CheckChildNodes(node.Parent); CheckChildNodes(node.Parent);
@ -301,7 +301,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
/// <param name="node">The node.</param> /// <param name="node">The node.</param>
private void SetupChildNodes(QuadNode node) private void SetupChildNodes(QuadNode node)
{ {
if (this.MinimumLeafSize.Width > node.Bounds.Width / 2 || this.MinimumLeafSize.Height > node.Bounds.Height / 2) if (MinimumLeafSize.Width > node.Bounds.Width / 2 || MinimumLeafSize.Height > node.Bounds.Height / 2)
// make sure we obey MinimumLeafSize. // make sure we obey MinimumLeafSize.
return; return;
@ -397,7 +397,7 @@ namespace DiIiS_NA.GameServer.Core.Types.QuadTrees
childNode.Parent = null; childNode.Parent = null;
} }
this.RootNode = nodeWithObjects; RootNode = nodeWithObjects;
} }
} }
} }

View File

@ -182,9 +182,9 @@ namespace DiIiS_NA.GameServer.Core.Types.SNO
public override string ToString() public override string ToString()
{ {
if (IsValid) if (IsValid)
return string.Format("[{0}] {1} - {2}", this.Group, this.Id, this.Name); return string.Format("[{0}] {1} - {2}", Group, Id, Name);
else else
return string.Format("[{0}] {1} - Invalid handle", _group, this.Id); return string.Format("[{0}] {1} - Invalid handle", _group, Id);
} }
} }
} }

View File

@ -91,7 +91,7 @@ namespace DiIiS_NA.GameServer.Core.Types.TagMap
for (int i = 0; i < TagMapSize; i++) for (int i = 0; i < TagMapSize; i++)
{ {
var entry = new TagMapEntry(stream); var entry = new TagMapEntry(stream);
this._tagMapEntries.Add(entry.TagID, entry); _tagMapEntries.Add(entry.TagID, entry);
} }
} }
@ -233,49 +233,49 @@ namespace DiIiS_NA.GameServer.Core.Types.TagMap
public TagMapEntry(MpqFileStream stream) public TagMapEntry(MpqFileStream stream)
{ {
this.Type = stream.ReadValueS32(); Type = stream.ReadValueS32();
this.TagID = stream.ReadValueS32(); TagID = stream.ReadValueS32();
switch (this.Type) switch (Type)
{ {
case 0: case 0:
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
case 1: case 1:
Float = stream.ReadValueF32(); Float = stream.ReadValueF32();
break; break;
case 2: // SNO case 2: // SNO
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
// TODO: Create strong type for gbid (at least i think they are) // TODO: Create strong type for gbid (at least i think they are)
case 3: case 3:
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
case 4: case 4:
this.ScriptFormula = new ScriptFormula(stream); ScriptFormula = new ScriptFormula(stream);
break; break;
// TODO: Strong type for group hashes // TODO: Strong type for group hashes
case 5: case 5:
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
// Todo: Strong type for ... hmmm.. is that a gameattributeindex? // Todo: Strong type for ... hmmm.. is that a gameattributeindex?
case 6: case 6:
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
// Todo: Strong type fo StartingLocationID // Todo: Strong type fo StartingLocationID
case 7: case 7:
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
default: default:
// if this break hits, blizz introduced a new key type and most likey we should have to react to it // if this break hits, blizz introduced a new key type and most likey we should have to react to it
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
this.Int = stream.ReadValueS32(); Int = stream.ReadValueS32();
break; break;
} }
} }

View File

@ -43,23 +43,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem
protected Brain(Actor body) protected Brain(Actor body)
{ {
this.Body = body; Body = body;
this.State = BrainState.Idle; State = BrainState.Idle;
this.Actions = new Queue<ActorAction>(); Actions = new Queue<ActorAction>();
} }
protected void QueueAction(ActorAction action) protected void QueueAction(ActorAction action)
{ {
this.Actions.Enqueue(action); Actions.Enqueue(action);
} }
public virtual void Update(int tickCounter) public virtual void Update(int tickCounter)
{ {
if (this.State == BrainState.Dead || this.Body == null || this.Body.World == null || this.State == BrainState.Off) if (State == BrainState.Dead || Body == null || Body.World == null || State == BrainState.Off)
return; return;
this.Think(tickCounter); // let the brain think. Think(tickCounter); // let the brain think.
this.Perform(tickCounter); // perform any outstanding actions. Perform(tickCounter); // perform any outstanding actions.
} }
/// <summary> /// <summary>
@ -73,38 +73,38 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem
/// </summary> /// </summary>
public virtual void Kill() public virtual void Kill()
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(0); CurrentAction.Cancel(0);
this.CurrentAction = null; CurrentAction = null;
} }
this.State = BrainState.Dead; State = BrainState.Dead;
} }
public void Activate() public void Activate()
{ {
if (this.State == BrainState.Off) if (State == BrainState.Off)
this.State = BrainState.Idle; State = BrainState.Idle;
} }
public void DeActivate() public void DeActivate()
{ {
this.CurrentAction = null; CurrentAction = null;
this.State = BrainState.Off; State = BrainState.Off;
} }
private void Perform(int tickCounter) private void Perform(int tickCounter)
{ {
if (this.CurrentAction == null) if (CurrentAction == null)
return; return;
if (!this.CurrentAction.Started) if (!CurrentAction.Started)
this.CurrentAction.Start(tickCounter); CurrentAction.Start(tickCounter);
else else
this.CurrentAction.Update(tickCounter); CurrentAction.Update(tickCounter);
if (this.CurrentAction.Done) if (CurrentAction.Done)
this.CurrentAction = null; CurrentAction = null;
} }
} }
} }

View File

@ -38,7 +38,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public AggressiveNPCBrain(Actor body) public AggressiveNPCBrain(Actor body)
: base(body) : base(body)
{ {
this.PresetPowers = new List<int>(); PresetPowers = new List<int>();
if (body.ActorData.MonsterSNO > 0) if (body.ActorData.MonsterSNO > 0)
{ {
@ -47,7 +47,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
if (monsterSkill.SNOPower > 0) if (monsterSkill.SNOPower > 0)
{ {
this.PresetPowers.Add(monsterSkill.SNOPower); PresetPowers.Add(monsterSkill.SNOPower);
} }
} }
} }
@ -55,31 +55,31 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public override void Think(int tickCounter) public override void Think(int tickCounter)
{ {
if (this.Body.Attributes[GameAttribute.Frozen] || if (Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] || Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] || Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] || Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable || Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null) Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(Body) != null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
_powerDelay = null; _powerDelay = null;
return; return;
} }
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
var monsters = this.Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList(); var monsters = Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
if (monsters.Count != 0) if (monsters.Count != 0)
{ {
_target = monsters[0]; _target = monsters[0];
@ -87,23 +87,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
if (powerToUse > 0) if (powerToUse > 0)
{ {
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
_powerDelay = null; _powerDelay = null;
this.Body.TranslateFacing(_target.Position, false); Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
} }
} }
else else
{ {
this.CurrentAction = new MoveToTargetWithPathfindAction( CurrentAction = new MoveToTargetWithPathfindAction(
this.Body, Body,
_target, _target,
attackRange + _target.ActorData.Cylinder.Ax2 attackRange + _target.ActorData.Cylinder.Ax2
); );
@ -112,7 +112,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
else else
{ {
this.CurrentAction = new MoveToPointAction(this.Body, this.Body.CheckPointPosition); CurrentAction = new MoveToPointAction(Body, Body.CheckPointPosition);
} }
} }
} }
@ -120,11 +120,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse() protected virtual int PickPowerToUse()
{ {
if (this.PresetPowers.Count > 0) if (PresetPowers.Count > 0)
{ {
int powerIndex = RandomHelper.Next(this.PresetPowers.Count); int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex])) if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex]; return PresetPowers[powerIndex];
} }
return -1; return -1;
@ -132,7 +132,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO) public void AddPresetPower(int powerSNO)
{ {
this.PresetPowers.Add(powerSNO); PresetPowers.Add(powerSNO);
} }
} }
} }

View File

@ -49,75 +49,75 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public HirelingBrain(Actor body, Player master) public HirelingBrain(Actor body, Player master)
: base(body) : base(body)
{ {
this.Owner = master; Owner = master;
this.PresetPowers = new List<int>(); PresetPowers = new List<int>();
if (body is Templar && body is MalthaelHireling) if (body is Templar && body is MalthaelHireling)
this.PresetPowers.Add(30592); //melee instant PresetPowers.Add(30592); //melee instant
if (body is Scoundrel) if (body is Scoundrel)
this.PresetPowers.Add(99902); //Scoundrel_ranged_Projectile PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
if (body is Enchantress) if (body is Enchantress)
this.PresetPowers.Add(30273); //HirelingMage_MagicMissile PresetPowers.Add(30273); //HirelingMage_MagicMissile
if (body is Leah) if (body is Leah)
this.PresetPowers.Add(99902); //Scoundrel_ranged_Projectile PresetPowers.Add(99902); //Scoundrel_ranged_Projectile
} }
public override void Think(int tickCounter) public override void Think(int tickCounter)
{ {
if (this.Owner == null) return; if (Owner == null) return;
if (this.Body.World.Game.Paused) return; if (Body.World.Game.Paused) return;
// check if in disabled state, if so cancel any action then do nothing // check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] || if (Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] || Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] || Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] || Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable || Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null) Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
_powerDelay = null; _powerDelay = null;
return; return;
} }
if (this.Body.Attributes[GameAttribute.Feared]) if (Body.Attributes[GameAttribute.Feared])
{ {
if (!this.Feared || this.CurrentAction == null) if (!Feared || CurrentAction == null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
this.Feared = true; Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction( CurrentAction = new MoveToPointWithPathfindAction(
this.Body, Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f) PowerContext.RandomDirection(Body.Position, 3f, 8f)
); );
return; return;
} }
else return; else return;
} }
else else
this.Feared = false; Feared = false;
// select and start executing a power if no active action // select and start executing a power if no active action
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
// do a little delay so groups of monsters don't all execute at once // do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
var targets = this.Owner.GetObjectsInRange<Monster>(40f).Where(p => !p.Dead && p.Visible).OrderBy(m => PowerMath.Distance2D(m.Position, this.Body.Position)).ToList(); var targets = Owner.GetObjectsInRange<Monster>(40f).Where(p => !p.Dead && p.Visible).OrderBy(m => PowerMath.Distance2D(m.Position, Body.Position)).ToList();
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, this.Owner.Position) < 80f) if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, Owner.Position) < 80f)
{ {
int powerToUse = PickPowerToUse(); int powerToUse = PickPowerToUse();
if (powerToUse > 0) if (powerToUse > 0)
@ -129,23 +129,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
_target = targets.First(); _target = targets.First();
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
_powerDelay = null; _powerDelay = null;
this.Body.TranslateFacing(_target.Position, false); Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
} }
} }
else else
{ {
this.CurrentAction = new MoveToTargetWithPathfindAction( CurrentAction = new MoveToTargetWithPathfindAction(
this.Body, Body,
_target, _target,
attackRange + _target.ActorData.Cylinder.Ax2 attackRange + _target.ActorData.Cylinder.Ax2
); );
@ -154,15 +154,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
else else
{ {
var distToMaster = PowerMath.Distance2D(this.Body.Position, this.Owner.Position); var distToMaster = PowerMath.Distance2D(Body.Position, Owner.Position);
if ((distToMaster > 8f) || (distToMaster < 3f)) if ((distToMaster > 8f) || (distToMaster < 3f))
{ {
var Rand = FastRandom.Instance; var Rand = FastRandom.Instance;
var position = this.Owner.Position; var position = Owner.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2); float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f); float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z); var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near); CurrentAction = new MoveToPointAction(Body, near);
} }
} }
} }
@ -171,11 +171,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse() protected virtual int PickPowerToUse()
{ {
// randomly used an implemented power // randomly used an implemented power
if (this.PresetPowers.Count > 0) if (PresetPowers.Count > 0)
{ {
int powerIndex = RandomHelper.Next(this.PresetPowers.Count); int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex])) if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex]; return PresetPowers[powerIndex];
} }
// no usable power // no usable power
@ -184,7 +184,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO) public void AddPresetPower(int powerSNO)
{ {
this.PresetPowers.Add(powerSNO); PresetPowers.Add(powerSNO);
} }
} }
} }

View File

@ -61,8 +61,8 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public LooterBrain(Actor body, bool lootsLegs) public LooterBrain(Actor body, bool lootsLegs)
: base(body) : base(body)
{ {
this.LootLegendaries = lootsLegs; LootLegendaries = lootsLegs;
this.PresetPowers = new Dictionary<int, Cooldown>(); PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data // build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0) if (body.ActorData.MonsterSNO > 0)
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
if (monsterSkill.SNOPower > 0) if (monsterSkill.SNOPower > 0)
{ {
this.PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f }); PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
} }
} }
} }
@ -82,52 +82,52 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
base.Update(tickCounter); base.Update(tickCounter);
List<Item> gold = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).ToList(); List<Item> gold = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).ToList();
foreach (var item in gold) foreach (var item in gold)
{ {
((this.Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage() ((Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
{ {
Place = new WorldPlace() Place = new WorldPlace()
{ {
Position = this.Body.Position, Position = Body.Position,
WorldID = this.Body.World.GlobalID, WorldID = Body.World.GlobalID,
}, },
Amount = item.Attributes[GameAttribute.ItemStackQuantityLo], Amount = item.Attributes[GameAttribute.ItemStackQuantityLo],
Type = FloatingAmountMessage.FloatType.Gold, Type = FloatingAmountMessage.FloatType.Gold,
}); });
((this.Body as Minion).Master as Player).Inventory.PickUpGold(item); ((Body as Minion).Master as Player).Inventory.PickUpGold(item);
((this.Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID); ((Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
item.Destroy(); item.Destroy();
} }
if (this.LootLegendaries) if (LootLegendaries)
{ {
List<Item> legendaries = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).ToList(); List<Item> legendaries = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).ToList();
foreach (var item in legendaries) foreach (var item in legendaries)
{ {
((this.Body as Minion).Master as Player).Inventory.PickUp(item); ((Body as Minion).Master as Player).Inventory.PickUp(item);
} }
} }
List<Item> shards = this.Body.GetObjectsInRange<Item>(5f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsBloodShard((m as Item).ItemType)).ToList(); List<Item> shards = Body.GetObjectsInRange<Item>(5f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsBloodShard((m as Item).ItemType)).ToList();
foreach (var item in shards) foreach (var item in shards)
{ {
((this.Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage() ((Body as Minion).Master as Player).InGameClient.SendMessage(new FloatingAmountMessage()
{ {
Place = new WorldPlace() Place = new WorldPlace()
{ {
Position = this.Body.Position, Position = Body.Position,
WorldID = this.Body.World.GlobalID, WorldID = Body.World.GlobalID,
}, },
Amount = item.Attributes[GameAttribute.ItemStackQuantityLo], Amount = item.Attributes[GameAttribute.ItemStackQuantityLo],
Type = FloatingAmountMessage.FloatType.BloodStone, Type = FloatingAmountMessage.FloatType.BloodStone,
}); });
((this.Body as Minion).Master as Player).Inventory.PickUpBloodShard(item); ((Body as Minion).Master as Player).Inventory.PickUpBloodShard(item);
((this.Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID); ((Body as Minion).Master as Player).GroundItems.Remove(item.GlobalID);
item.Destroy(); item.Destroy();
} }
} }
@ -136,39 +136,39 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
// this needed? /mdz // this needed? /mdz
//if (this.Body is NPC) return; //if (this.Body is NPC) return;
if ((this.Body as Minion).Master == null) return; if ((Body as Minion).Master == null) return;
if (this.Body.World.Game.Paused) return; if (Body.World.Game.Paused) return;
// select and start executing a power if no active action // select and start executing a power if no active action
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
// do a little delay so groups of monsters don't all execute at once // do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble()); _powerDelay = new SecondsTickTimer(Body.World.Game, (float)RandomHelper.NextDouble());
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
List<Actor> targets = this.Body.GetObjectsInRange<Item>(40f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).Cast<Actor>().ToList(); List<Actor> targets = Body.GetObjectsInRange<Item>(40f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && Item.IsGold((m as Item).ItemType)).Cast<Actor>().ToList();
if (this.LootLegendaries) if (LootLegendaries)
targets.Concat(this.Body.GetObjectsInRange<Item>(40f).Where(m => ((this.Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).Cast<Actor>().ToList()); targets.Concat(Body.GetObjectsInRange<Item>(40f).Where(m => ((Body as Minion).Master as Player).GroundItems.ContainsKey(m.GlobalID) && (m as Item).ItemDefinition.Name.Contains("Unique_")).Cast<Actor>().ToList());
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position) < 80f) if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position) < 80f)
{ {
_target = targets.First(); _target = targets.First();
//Logger.Trace("MoveToTargetWithPathfindAction to target"); //Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToPointAction(this.Body, _target.Position); CurrentAction = new MoveToPointAction(Body, _target.Position);
} }
else else
{ {
var distToMaster = PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position); var distToMaster = PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position);
if ((distToMaster > 8f) || (distToMaster < 3f)) if ((distToMaster > 8f) || (distToMaster < 3f))
{ {
var Rand = FastRandom.Instance; var Rand = FastRandom.Instance;
var position = (this.Body as Minion).Master.Position; var position = (Body as Minion).Master.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2); float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f); float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z); var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near); CurrentAction = new MoveToPointAction(Body, near);
} }
} }
} }

View File

@ -57,7 +57,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public MinionBrain(Actor body) public MinionBrain(Actor body)
: base(body) : base(body)
{ {
this.PresetPowers = new Dictionary<int, Cooldown>(); PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data // build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0) if (body.ActorData.MonsterSNO > 0)
@ -67,7 +67,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
if (monsterSkill.SNOPower > 0) if (monsterSkill.SNOPower > 0)
{ {
this.PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f }); PresetPowers.Add(monsterSkill.SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = 1f });
} }
} }
} }
@ -77,70 +77,70 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
// this needed? /mdz // this needed? /mdz
//if (this.Body is NPC) return; //if (this.Body is NPC) return;
if ((this.Body as Minion).Master == null) return; if ((Body as Minion).Master == null) return;
if (this.Body.World.Game.Paused) return; if (Body.World.Game.Paused) return;
// check if in disabled state, if so cancel any action then do nothing // check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] || if (Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] || Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] || Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] || Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable || Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null) Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
_powerDelay = null; _powerDelay = null;
return; return;
} }
if (this.Body.Attributes[GameAttribute.Feared]) if (Body.Attributes[GameAttribute.Feared])
{ {
if (!this.Feared || this.CurrentAction == null) if (!Feared || CurrentAction == null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
this.Feared = true; Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction( CurrentAction = new MoveToPointWithPathfindAction(
this.Body, Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f) PowerContext.RandomDirection(Body.Position, 3f, 8f)
); );
return; return;
} }
else return; else return;
} }
else else
this.Feared = false; Feared = false;
// select and start executing a power if no active action // select and start executing a power if no active action
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
// do a little delay so groups of monsters don't all execute at once // do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, (float)RandomHelper.NextDouble()); _powerDelay = new SecondsTickTimer(Body.World.Game, (float)RandomHelper.NextDouble());
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
List<Actor> targets = (this.Body as Minion).Master List<Actor> targets = (Body as Minion).Master
.GetObjectsInRange<Monster>(40f) .GetObjectsInRange<Monster>(40f)
.Where(m => !m.Dead && m.Visible && m.SNO.IsTargetable()) .Where(m => !m.Dead && m.Visible && m.SNO.IsTargetable())
.OrderBy(m => PowerMath.Distance2D(m.Position, this.Body.Position)) .OrderBy(m => PowerMath.Distance2D(m.Position, Body.Position))
.Cast<Actor>() .Cast<Actor>()
.ToList(); .ToList();
if (this.Body.World.Game.PvP) if (Body.World.Game.PvP)
targets = (this.Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (this.Body as Minion).Master.GlobalID && p.Attributes[GameAttribute.TeamID] != (this.Body as Minion).Master.Attributes[GameAttribute.TeamID]).Cast<Actor>().ToList(); targets = (Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (Body as Minion).Master.GlobalID && p.Attributes[GameAttribute.TeamID] != (Body as Minion).Master.Attributes[GameAttribute.TeamID]).Cast<Actor>().ToList();
if (this.Body.World.IsPvP) if (Body.World.IsPvP)
targets = (this.Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (this.Body as Minion).Master.GlobalID).Cast<Actor>().ToList(); targets = (Body as Minion).Master.GetObjectsInRange<Player>(30f).Where(p => p.GlobalID != (Body as Minion).Master.GlobalID).Cast<Actor>().ToList();
if (targets.Count != 0 && PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position) < 80f) if (targets.Count != 0 && PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position) < 80f)
{ {
var elites = targets.Where(t => t is Champion || t is Rare || t is RareMinion); var elites = targets.Where(t => t is Champion || t is Rare || t is RareMinion);
if (elites.Count() > 0) if (elites.Count() > 0)
@ -152,30 +152,30 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
if (powerToUse > 0) if (powerToUse > 0)
{ {
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (this.Body.WalkSpeed != 0) if (Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
float cdReduction = (this.Body as Minion).CooldownReduction; float cdReduction = (Body as Minion).CooldownReduction;
//Logger.Trace("PowerAction to target"); //Logger.Trace("PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill) if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (7f * cdReduction) }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (7f * cdReduction) };
if (this.PresetPowers[powerToUse].CooldownTime > 0f) if (PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = (this.PresetPowers[powerToUse].CooldownTime * cdReduction) }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = (PresetPowers[powerToUse].CooldownTime * cdReduction) };
} }
else else
{ {
Logger.Trace("MoveToTargetWithPathfindAction to target"); Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction( CurrentAction = new MoveToTargetWithPathfindAction(
this.Body, Body,
//( //(
_target,// + MovementHelpers.GetMovementPosition( _target,// + MovementHelpers.GetMovementPosition(
//new Vector3D(0, 0, 0), //new Vector3D(0, 0, 0),
@ -191,15 +191,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
else else
{ {
var distToMaster = PowerMath.Distance2D(this.Body.Position, (this.Body as Minion).Master.Position); var distToMaster = PowerMath.Distance2D(Body.Position, (Body as Minion).Master.Position);
if ((distToMaster > 8f) || (distToMaster < 3f)) if ((distToMaster > 8f) || (distToMaster < 3f))
{ {
var Rand = FastRandom.Instance; var Rand = FastRandom.Instance;
var position = (this.Body as Minion).Master.Position; var position = (Body as Minion).Master.Position;
float angle = (float)(Rand.NextDouble() * Math.PI * 2); float angle = (float)(Rand.NextDouble() * Math.PI * 2);
float radius = 3f + (float)Rand.NextDouble() * (8f - 3f); float radius = 3f + (float)Rand.NextDouble() * (8f - 3f);
var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z); var near = new Vector3D(position.X + (float)Math.Cos(angle) * radius, position.Y + (float)Math.Sin(angle) * radius, position.Z);
this.CurrentAction = new MoveToPointAction(this.Body, near); CurrentAction = new MoveToPointAction(Body, near);
} }
} }
} }
@ -208,17 +208,17 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse() protected virtual int PickPowerToUse()
{ {
if (!_warnedNoPowers && this.PresetPowers.Count == 0) if (!_warnedNoPowers && PresetPowers.Count == 0)
{ {
Logger.Debug("Minion \"{0}\" has no usable powers. ", this.Body.Name); Logger.Debug("Minion \"{0}\" has no usable powers. ", Body.Name);
_warnedNoPowers = true; _warnedNoPowers = true;
} }
// randomly used an implemented power // randomly used an implemented power
if (this.PresetPowers.Count > 0) if (PresetPowers.Count > 0)
{ {
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key; //int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
List<int> availablePowers = Enumerable.ToList(this.PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerSystem.PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key)); List<int> availablePowers = Enumerable.ToList(PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key));
if (availablePowers.Where(p => p != 30592).Count() > 0) if (availablePowers.Where(p => p != 30592).Count() > 0)
return availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())]; return availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
else else
@ -232,23 +232,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO) public void AddPresetPower(int powerSNO)
{ {
if (this.PresetPowers.ContainsKey(powerSNO)) if (PresetPowers.ContainsKey(powerSNO))
{ {
// Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"", // Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"",
//powerSNO, this.Body.ActorSNO.Name); //powerSNO, this.Body.ActorSNO.Name);
return; return;
} }
if (this.PresetPowers.ContainsKey(30592)) //if can cast melee if (PresetPowers.ContainsKey(30592)) //if can cast melee
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f }); PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
else else
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() }); PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() });
} }
public void RemovePresetPower(int powerSNO) public void RemovePresetPower(int powerSNO)
{ {
if (this.PresetPowers.ContainsKey(powerSNO)) if (PresetPowers.ContainsKey(powerSNO))
{ {
this.PresetPowers.Remove(powerSNO); PresetPowers.Remove(powerSNO);
} }
} }
} }

View File

@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public MonsterBrain(Actor body) public MonsterBrain(Actor body)
: base(body) : base(body)
{ {
this.PresetPowers = new Dictionary<int, Cooldown>(); PresetPowers = new Dictionary<int, Cooldown>();
// build list of powers defined in monster mpq data // build list of powers defined in monster mpq data
if (body.ActorData.MonsterSNO > 0) if (body.ActorData.MonsterSNO > 0)
@ -72,117 +72,117 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
for (int i = 0; i < monsterData.SkillDeclarations.Count(); i++) for (int i = 0; i < monsterData.SkillDeclarations.Count(); i++)
{ {
if (monsterData.SkillDeclarations[i].SNOPower == -1) continue; if (monsterData.SkillDeclarations[i].SNOPower == -1) continue;
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower)) if (PowerLoader.HasImplementationForPowerSNO(monsterData.SkillDeclarations[i].SNOPower))
{ {
var cooldownTime = monsterData.MonsterSkillDeclarations[i].Timer / 10f; var cooldownTime = monsterData.MonsterSkillDeclarations[i].Timer / 10f;
this.PresetPowers.Add(monsterData.SkillDeclarations[i].SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = cooldownTime }); PresetPowers.Add(monsterData.SkillDeclarations[i].SNOPower, new Cooldown { CooldownTimer = null, CooldownTime = cooldownTime });
} }
} }
if (!monsterData.SkillDeclarations.Any(s => s.SNOPower == 30592)) if (!monsterData.SkillDeclarations.Any(s => s.SNOPower == 30592))
this.PresetPowers.Add(30592, new Cooldown { CooldownTimer = null, CooldownTime = 0f }); //hack for dummy mobs without powers PresetPowers.Add(30592, new Cooldown { CooldownTimer = null, CooldownTime = 0f }); //hack for dummy mobs without powers
} }
} }
public override void Think(int tickCounter) public override void Think(int tickCounter)
{ {
if (this.Body.SNO == ActorSno._uber_siegebreakerdemon || if (Body.SNO == ActorSno._uber_siegebreakerdemon ||
this.Body.SNO == ActorSno._a4dun_garden_corruption_monster || Body.SNO == ActorSno._a4dun_garden_corruption_monster ||
this.Body.SNO == ActorSno._a4dun_garden_hellportal_pillar) Body.SNO == ActorSno._a4dun_garden_hellportal_pillar)
return; return;
if (this.Body.SNO == ActorSno._belialvoiceover) //BelialVoiceover if (Body.SNO == ActorSno._belialvoiceover) //BelialVoiceover
return; return;
if (this.Body.Hidden == true) if (Body.Hidden == true)
return; return;
if (this.CurrentAction != null && this.PriorityTarget != null && this.PriorityTarget.Attributes[GameAttribute.Is_Helper] == true) if (CurrentAction != null && PriorityTarget != null && PriorityTarget.Attributes[GameAttribute.Is_Helper] == true)
{ {
this.PriorityTarget = null; PriorityTarget = null;
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
return; return;
} }
if (!(tickCounter % 60 == 0)) return; if (!(tickCounter % 60 == 0)) return;
if (this.Body is NPC) return; if (Body is NPC) return;
if (!this.Body.Visible || this.Body.Dead) return; if (!Body.Visible || Body.Dead) return;
if (this.Body.World.Game.Paused) return; if (Body.World.Game.Paused) return;
if (this.Body.Attributes[GameAttribute.Disabled]) return; if (Body.Attributes[GameAttribute.Disabled]) return;
if (this.Body.Attributes[GameAttribute.Frozen] || if (Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] || Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] || Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] || Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable || Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(this.Body) != null || Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null ||
this.Body.World.BuffManager.GetFirstBuff<SummonedBuff>(this.Body) != null) Body.World.BuffManager.GetFirstBuff<SummonedBuff>(Body) != null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
_powerDelay = null; _powerDelay = null;
return; return;
} }
if (this.Body.Attributes[GameAttribute.Feared]) if (Body.Attributes[GameAttribute.Feared])
{ {
if (!this.Feared || this.CurrentAction == null) if (!Feared || CurrentAction == null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
this.Feared = true; Feared = true;
this.CurrentAction = new MoveToPointWithPathfindAction( CurrentAction = new MoveToPointWithPathfindAction(
this.Body, Body,
PowerContext.RandomDirection(this.Body.Position, 3f, 8f) PowerContext.RandomDirection(Body.Position, 3f, 8f)
); );
return; return;
} }
else return; else return;
} }
else else
this.Feared = false; Feared = false;
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null || this.Body.GetObjectsInRange<Player>(50f).Count != 0) if (AttackedBy != null || Body.GetObjectsInRange<Player>(50f).Count != 0)
{ {
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null) if (AttackedBy != null)
this.PriorityTarget = AttackedBy; PriorityTarget = AttackedBy;
if (this.PriorityTarget == null) if (PriorityTarget == null)
{ {
List<Actor> targets = new List<Actor>(); List<Actor> targets = new List<Actor>();
if (this.Body.Attributes[GameAttribute.Team_Override] == 1) if (Body.Attributes[GameAttribute.Team_Override] == 1)
targets = this.Body.GetObjectsInRange<Monster>(60f) targets = Body.GetObjectsInRange<Monster>(60f)
.Where(p => !p.Dead) .Where(p => !p.Dead)
.OrderBy((monster) => PowerMath.Distance2D(monster.Position, this.Body.Position)) .OrderBy((monster) => PowerMath.Distance2D(monster.Position, Body.Position))
.Cast<Actor>() .Cast<Actor>()
.ToList(); .ToList();
else else
targets = this.Body.GetActorsInRange(50f) targets = Body.GetActorsInRange(50f)
.Where(p => ((p is Player) && !p.Dead && p.Attributes[GameAttribute.Loading] == false && p.Attributes[GameAttribute.Is_Helper] == false && p.World.BuffManager.GetFirstBuff<ActorGhostedBuff>(p) == null) .Where(p => ((p is Player) && !p.Dead && p.Attributes[GameAttribute.Loading] == false && p.Attributes[GameAttribute.Is_Helper] == false && p.World.BuffManager.GetFirstBuff<ActorGhostedBuff>(p) == null)
|| ((p is Minion) && !p.Dead && p.Attributes[GameAttribute.Is_Helper] == false) || ((p is Minion) && !p.Dead && p.Attributes[GameAttribute.Is_Helper] == false)
|| (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade()) || (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade())
|| ((p is Hireling) && !p.Dead) || ((p is Hireling) && !p.Dead)
) )
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position)) .OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>() .Cast<Actor>()
.ToList(); .ToList();
@ -191,49 +191,49 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
_target = targets.First(); _target = targets.First();
} }
else else
_target = this.PriorityTarget; _target = PriorityTarget;
int powerToUse = PickPowerToUse(); int powerToUse = PickPowerToUse();
if (powerToUse > 0) if (powerToUse > 0)
{ {
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (this.Body.WalkSpeed != 0) if (Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false); Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill) if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill) if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f) if (PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
if (powerToUse == 96925 || if (powerToUse == 96925 ||
powerToUse == 223284) powerToUse == 223284)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, 10f), CooldownTime = 10f }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, 10f), CooldownTime = 10f };
} }
else if (this.Body.WalkSpeed != 0) else if (Body.WalkSpeed != 0)
{ {
if (this.Body.SNO.IsWoodwraithOrWasp()) if (Body.SNO.IsWoodwraithOrWasp())
{ {
Logger.Trace("MoveToPointAction to target"); Logger.Trace("MoveToPointAction to target");
this.CurrentAction = new MoveToPointAction( CurrentAction = new MoveToPointAction(
this.Body, _target.Position Body, _target.Position
); );
} }
else else
{ {
Logger.Trace("MoveToTargetWithPathfindAction to target"); Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction( CurrentAction = new MoveToTargetWithPathfindAction(
this.Body, Body,
_target, _target,
attackRange + _target.ActorData.Cylinder.Ax2, attackRange + _target.ActorData.Cylinder.Ax2,
powerToUse powerToUse
@ -242,60 +242,60 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
else else
{ {
switch (this.Body.SNO) switch (Body.SNO)
{ {
case ActorSno._a1dun_leor_firewall2: case ActorSno._a1dun_leor_firewall2:
powerToUse = 223284; powerToUse = 223284;
break; break;
} }
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill) if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill) if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f) if (PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
if (powerToUse == 96925 || if (powerToUse == 96925 ||
powerToUse == 223284) powerToUse == 223284)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, 10f), CooldownTime = 10f }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, 10f), CooldownTime = 10f };
} }
} }
} }
} }
else if (this.Body.GetObjectsInRange<Living>(50f).Count != 0) else if (Body.GetObjectsInRange<Living>(50f).Count != 0)
{ {
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1.0f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1.0f);
if (AttackedBy != null) if (AttackedBy != null)
this.PriorityTarget = AttackedBy; PriorityTarget = AttackedBy;
if (this.PriorityTarget == null) if (PriorityTarget == null)
{ {
List<Actor> targets = new List<Actor>(); List<Actor> targets = new List<Actor>();
targets = this.Body.GetActorsInRange(50f) targets = Body.GetActorsInRange(50f)
.Where(p => ((p is LorathNahr_NPC) && !p.Dead) .Where(p => ((p is LorathNahr_NPC) && !p.Dead)
|| ((p is CaptainRumford) && !p.Dead) || ((p is CaptainRumford) && !p.Dead)
|| (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade()) || (p is DesctructibleLootContainer && p.SNO.IsDoorOrBarricade())
|| ((p is Cain) && !p.Dead)) || ((p is Cain) && !p.Dead))
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position)) .OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>() .Cast<Actor>()
.ToList(); .ToList();
if (targets.Count == 0) if (targets.Count == 0)
{ {
targets = this.Body.GetActorsInRange(20f) targets = Body.GetActorsInRange(20f)
.Where(p => ((p is Monster) && !p.Dead) .Where(p => ((p is Monster) && !p.Dead)
|| ((p is CaptainRumford) && !p.Dead) || ((p is CaptainRumford) && !p.Dead)
) )
.OrderBy((actor) => PowerMath.Distance2D(actor.Position, this.Body.Position)) .OrderBy((actor) => PowerMath.Distance2D(actor.Position, Body.Position))
.Cast<Actor>() .Cast<Actor>()
.ToList(); .ToList();
@ -305,7 +305,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
foreach (var tar in targets) foreach (var tar in targets)
if (_target == null) if (_target == null)
if (tar is Monster && tar != this.Body) if (tar is Monster && tar != Body)
if (((tar as Monster).Brain as MonsterBrain).AttackedBy != null) if (((tar as Monster).Brain as MonsterBrain).AttackedBy != null)
_target = ((tar as Monster).Brain as MonsterBrain).AttackedBy; _target = ((tar as Monster).Brain as MonsterBrain).AttackedBy;
} }
@ -318,13 +318,13 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ _target = tar; break; } { _target = tar; break; }
} }
else else
_target = this.PriorityTarget; _target = PriorityTarget;
int powerToUse = PickPowerToUse(); int powerToUse = PickPowerToUse();
if (powerToUse > 0) if (powerToUse > 0)
{ {
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
if (_target == null) if (_target == null)
{ {
/* /*
@ -339,39 +339,39 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
//*/ //*/
return; return;
} }
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : Math.Min((float)power.EvalTag(PowerKeys.AttackRadius), 35f)) : 35f);
float targetDistance = PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (this.Body.WalkSpeed != 0) if (Body.WalkSpeed != 0)
this.Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn Body.TranslateFacing(_target.Position, false); //columns and other non-walkable shit can't turn
//Logger.Trace("PowerAction to target"); //Logger.Trace("PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
if (power is SummoningSkill) if (power is SummoningSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill) if (power is MonsterAffixSkill)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[powerToUse].CooldownTime > 0f) if (PresetPowers[powerToUse].CooldownTime > 0f)
this.PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[powerToUse].CooldownTime), CooldownTime = this.PresetPowers[powerToUse].CooldownTime }; PresetPowers[powerToUse] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[powerToUse].CooldownTime), CooldownTime = PresetPowers[powerToUse].CooldownTime };
} }
else if (this.Body.WalkSpeed != 0) else if (Body.WalkSpeed != 0)
{ {
if (this.Body.SNO.IsWoodwraithOrWasp()) if (Body.SNO.IsWoodwraithOrWasp())
{ {
Logger.Trace("MoveToPointAction to target"); Logger.Trace("MoveToPointAction to target");
this.CurrentAction = new MoveToPointAction( CurrentAction = new MoveToPointAction(
this.Body, _target.Position Body, _target.Position
); );
} }
else else
{ {
Logger.Trace("MoveToTargetWithPathfindAction to target"); Logger.Trace("MoveToTargetWithPathfindAction to target");
this.CurrentAction = new MoveToTargetWithPathfindAction( CurrentAction = new MoveToTargetWithPathfindAction(
this.Body, Body,
//( //(
_target,// + MovementHelpers.GetMovementPosition( _target,// + MovementHelpers.GetMovementPosition(
//new Vector3D(0, 0, 0), //new Vector3D(0, 0, 0),
@ -392,8 +392,8 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
else else
{ {
//Logger.Trace("No enemies in range, return to master"); //Logger.Trace("No enemies in range, return to master");
if (this.Body.Position != this.Body.CheckPointPosition) if (Body.Position != Body.CheckPointPosition)
this.CurrentAction = new MoveToPointWithPathfindAction(this.Body, this.Body.CheckPointPosition); CurrentAction = new MoveToPointWithPathfindAction(Body, Body.CheckPointPosition);
} }
} }
} }
@ -419,36 +419,36 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void FastAttack(Actor target, int skillSNO) public void FastAttack(Actor target, int skillSNO)
{ {
PowerScript power = PowerLoader.CreateImplementationForPowerSNO(skillSNO); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(skillSNO);
power.User = this.Body; power.User = Body;
if (this.Body.WalkSpeed != 0) if (Body.WalkSpeed != 0)
this.Body.TranslateFacing(target.Position, false); //columns and other non-walkable shit can't turn Body.TranslateFacing(target.Position, false); //columns and other non-walkable shit can't turn
//Logger.Trace("Fast PowerAction to target"); //Logger.Trace("Fast PowerAction to target");
this.CurrentAction = new PowerAction(this.Body, skillSNO, target); CurrentAction = new PowerAction(Body, skillSNO, target);
if (power is SummoningSkill) if (power is SummoningSkill)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (this.Body is Boss ? 15f : 7f) }; PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (Body is Boss ? 15f : 7f) };
if (power is MonsterAffixSkill) if (power is MonsterAffixSkill)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime }; PresetPowers[skillSNO] = new Cooldown { CooldownTimer = null, CooldownTime = (power as MonsterAffixSkill).CooldownTime };
if (this.PresetPowers[skillSNO].CooldownTime > 0f) if (PresetPowers[skillSNO].CooldownTime > 0f)
this.PresetPowers[skillSNO] = new Cooldown { CooldownTimer = new SecondsTickTimer(this.Body.World.Game, this.PresetPowers[skillSNO].CooldownTime), CooldownTime = this.PresetPowers[skillSNO].CooldownTime }; PresetPowers[skillSNO] = new Cooldown { CooldownTimer = new SecondsTickTimer(Body.World.Game, PresetPowers[skillSNO].CooldownTime), CooldownTime = PresetPowers[skillSNO].CooldownTime };
} }
protected virtual int PickPowerToUse() protected virtual int PickPowerToUse()
{ {
if (!_warnedNoPowers && this.PresetPowers.Count == 0) if (!_warnedNoPowers && PresetPowers.Count == 0)
{ {
Logger.Info("Monster \"{0}\" has no usable powers. {1} are defined in mpq data.", this.Body.Name, _mpqPowerCount); Logger.Info("Monster \"{0}\" has no usable powers. {1} are defined in mpq data.", Body.Name, _mpqPowerCount);
_warnedNoPowers = true; _warnedNoPowers = true;
} }
// randomly used an implemented power // randomly used an implemented power
if (this.PresetPowers.Count > 0) if (PresetPowers.Count > 0)
{ {
//int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key; //int power = this.PresetPowers[RandomHelper.Next(this.PresetPowers.Count)].Key;
List<int> availablePowers = Enumerable.ToList(this.PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerSystem.PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key)); List<int> availablePowers = Enumerable.ToList(PresetPowers.Where(p => (p.Value.CooldownTimer == null || p.Value.CooldownTimer.TimedOut) && PowerLoader.HasImplementationForPowerSNO(p.Key)).Select(p => p.Key));
if (availablePowers.Where(p => p != 30592).Count() > 0) if (availablePowers.Where(p => p != 30592).Count() > 0)
{ {
int SelectedPower = availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())]; int SelectedPower = availablePowers.Where(p => p != 30592).ToList()[RandomHelper.Next(availablePowers.Where(p => p != 30592).ToList().Count())];
@ -467,23 +467,23 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO) public void AddPresetPower(int powerSNO)
{ {
if (this.PresetPowers.ContainsKey(powerSNO)) if (PresetPowers.ContainsKey(powerSNO))
{ {
// Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"", // Logger.Debug("AddPresetPower(): power sno {0} already defined for monster \"{1}\"",
//powerSNO, this.Body.ActorSNO.Name); //powerSNO, this.Body.ActorSNO.Name);
return; return;
} }
if (this.PresetPowers.ContainsKey(30592)) //if can cast melee if (PresetPowers.ContainsKey(30592)) //if can cast melee
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f }); PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 5f });
else else
this.PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.NextDouble() }); PresetPowers.Add(powerSNO, new Cooldown { CooldownTimer = null, CooldownTime = 1f + (float)FastRandom.Instance.NextDouble() });
} }
public void RemovePresetPower(int powerSNO) public void RemovePresetPower(int powerSNO)
{ {
if (this.PresetPowers.ContainsKey(powerSNO)) if (PresetPowers.ContainsKey(powerSNO))
{ {
this.PresetPowers.Remove(powerSNO); PresetPowers.Remove(powerSNO);
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public StayAggressiveNPCBrain(Actor body) public StayAggressiveNPCBrain(Actor body)
: base(body) : base(body)
{ {
this.PresetPowers = new List<int>(); PresetPowers = new List<int>();
if (body.ActorData.MonsterSNO > 0) if (body.ActorData.MonsterSNO > 0)
@ -53,7 +53,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
{ {
if (monsterSkill.SNOPower > 0) if (monsterSkill.SNOPower > 0)
{ {
this.PresetPowers.Add(monsterSkill.SNOPower); PresetPowers.Add(monsterSkill.SNOPower);
} }
} }
} }
@ -65,17 +65,17 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
//if (this.Body is NPC) return; //if (this.Body is NPC) return;
// check if in disabled state, if so cancel any action then do nothing // check if in disabled state, if so cancel any action then do nothing
if (this.Body.Attributes[GameAttribute.Frozen] || if (Body.Attributes[GameAttribute.Frozen] ||
this.Body.Attributes[GameAttribute.Stunned] || Body.Attributes[GameAttribute.Stunned] ||
this.Body.Attributes[GameAttribute.Blind] || Body.Attributes[GameAttribute.Blind] ||
this.Body.Attributes[GameAttribute.Webbed] || Body.Attributes[GameAttribute.Webbed] ||
this.Body.Disable || Body.Disable ||
this.Body.World.BuffManager.GetFirstBuff<PowerSystem.Implementations.KnockbackBuff>(this.Body) != null) Body.World.BuffManager.GetFirstBuff<KnockbackBuff>(Body) != null)
{ {
if (this.CurrentAction != null) if (CurrentAction != null)
{ {
this.CurrentAction.Cancel(tickCounter); CurrentAction.Cancel(tickCounter);
this.CurrentAction = null; CurrentAction = null;
} }
_powerDelay = null; _powerDelay = null;
@ -83,15 +83,15 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
// select and start executing a power if no active action // select and start executing a power if no active action
if (this.CurrentAction == null) if (CurrentAction == null)
{ {
// do a little delay so groups of monsters don't all execute at once // do a little delay so groups of monsters don't all execute at once
if (_powerDelay == null) if (_powerDelay == null)
_powerDelay = new SecondsTickTimer(this.Body.World.Game, 1f); _powerDelay = new SecondsTickTimer(Body.World.Game, 1f);
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
var monsters = this.Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList(); var monsters = Body.GetObjectsInRange<Monster>(40f).Where(m => m.Visible & !m.Dead).ToList();
if (monsters.Count != 0) if (monsters.Count != 0)
{ {
_target = monsters[0]; _target = monsters[0];
@ -100,18 +100,18 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
int powerToUse = PickPowerToUse(); int powerToUse = PickPowerToUse();
if (powerToUse > 0) if (powerToUse > 0)
{ {
PowerSystem.PowerScript power = PowerSystem.PowerLoader.CreateImplementationForPowerSNO(powerToUse); PowerScript power = PowerLoader.CreateImplementationForPowerSNO(powerToUse);
power.User = this.Body; power.User = Body;
float attackRange = this.Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f); float attackRange = Body.ActorData.Cylinder.Ax2 + (power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerToUse == 30592 ? 10f : power.EvalTag(PowerKeys.AttackRadius)) : 35f);
float targetDistance = PowerSystem.PowerMath.Distance2D(_target.Position, this.Body.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Body.Position);
if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2) if (targetDistance < attackRange + _target.ActorData.Cylinder.Ax2)
{ {
if (_powerDelay.TimedOut) if (_powerDelay.TimedOut)
{ {
_powerDelay = null; _powerDelay = null;
this.Body.TranslateFacing(_target.Position, false); Body.TranslateFacing(_target.Position, false);
this.CurrentAction = new PowerAction(this.Body, powerToUse, _target); CurrentAction = new PowerAction(Body, powerToUse, _target);
} }
} }
else else
@ -122,7 +122,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
} }
else else
{ {
this.CurrentAction = new MoveToPointAction(this.Body, this.Body.CheckPointPosition); CurrentAction = new MoveToPointAction(Body, Body.CheckPointPosition);
} }
} }
} }
@ -131,11 +131,11 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
protected virtual int PickPowerToUse() protected virtual int PickPowerToUse()
{ {
// randomly used an implemented power // randomly used an implemented power
if (this.PresetPowers.Count > 0) if (PresetPowers.Count > 0)
{ {
int powerIndex = RandomHelper.Next(this.PresetPowers.Count); int powerIndex = RandomHelper.Next(PresetPowers.Count);
if (PowerSystem.PowerLoader.HasImplementationForPowerSNO(this.PresetPowers[powerIndex])) if (PowerLoader.HasImplementationForPowerSNO(PresetPowers[powerIndex]))
return this.PresetPowers[powerIndex]; return PresetPowers[powerIndex];
} }
// no usable power // no usable power
@ -144,7 +144,7 @@ namespace DiIiS_NA.GameServer.GSSystem.AISystem.Brains
public void AddPresetPower(int powerSNO) public void AddPresetPower(int powerSNO)
{ {
this.PresetPowers.Add(powerSNO); PresetPowers.Add(powerSNO);
} }
} }
} }

View File

@ -24,9 +24,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
protected ActorAction(Actor owner) protected ActorAction(Actor owner)
{ {
this.Owner = owner; Owner = owner;
this.Started = false; Started = false;
this.Done = false; Done = false;
} }
public abstract void Start(int tickCounter); public abstract void Start(int tickCounter);

View File

@ -32,15 +32,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
_power.World = owner.World; _power.World = owner.World;
_power.User = owner; _power.User = owner;
_powerRan = false; _powerRan = false;
_baseAttackRadius = this.Owner.ActorData.Cylinder.Ax2 + (_power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerSNO == 30592 ? 10f : _power.EvalTag(PowerKeys.AttackRadius)) : 35f); _baseAttackRadius = Owner.ActorData.Cylinder.Ax2 + (_power.EvalTag(PowerKeys.AttackRadius) > 0f ? (powerSNO == 30592 ? 10f : _power.EvalTag(PowerKeys.AttackRadius)) : 35f);
_ownerMover = new ActorMover(owner); _ownerMover = new ActorMover(owner);
_target = target; _target = target;
} }
public override void Start(int tickCounter) public override void Start(int tickCounter)
{ {
this.Started = true; Started = true;
this.Update(tickCounter); Update(tickCounter);
} }
public override void Update(int tickCounter) public override void Update(int tickCounter)
@ -49,7 +49,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
if (_powerRan) if (_powerRan)
{ {
if (_powerFinishTimer.TimedOut) if (_powerFinishTimer.TimedOut)
this.Done = true; Done = true;
return; return;
} }
@ -57,31 +57,31 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
// try to get nearest target if no target yet acquired // try to get nearest target if no target yet acquired
if (_target == null) if (_target == null)
{ {
if (this.Owner is Minion || this.Owner is Hireling) // assume minions are player controlled and are targeting monsters if (Owner is Minion || Owner is Hireling) // assume minions are player controlled and are targeting monsters
{ {
if ((this.Owner.World.Game.PvP || this.Owner.World.IsPvP) && (this.Owner as Minion).Master != null) if ((Owner.World.Game.PvP || Owner.World.IsPvP) && (Owner as Minion).Master != null)
_target = this.Owner.GetPlayersInRange(MaxTargetRange) _target = Owner.GetPlayersInRange(MaxTargetRange)
.Where( .Where(
p => p.GlobalID != (this.Owner as Minion).Master.GlobalID) p => p.GlobalID != (Owner as Minion).Master.GlobalID)
.OrderBy( .OrderBy(
(player) => PowerMath.Distance2D(player.Position, this.Owner.Position)) (player) => PowerMath.Distance2D(player.Position, Owner.Position))
.FirstOrDefault(); .FirstOrDefault();
else else
_target = this.Owner.GetMonstersInRange(MaxTargetRange).OrderBy( _target = Owner.GetMonstersInRange(MaxTargetRange).OrderBy(
(monster) => PowerMath.Distance2D(monster.Position, this.Owner.Position)) (monster) => PowerMath.Distance2D(monster.Position, Owner.Position))
.FirstOrDefault(); .FirstOrDefault();
} }
else // monsters targeting players else // monsters targeting players
{ {
_target = this.Owner.GetPlayersInRange(MaxTargetRange).OrderBy( _target = Owner.GetPlayersInRange(MaxTargetRange).OrderBy(
(player) => PowerMath.Distance2D(player.Position, this.Owner.Position)) (player) => PowerMath.Distance2D(player.Position, Owner.Position))
.FirstOrDefault(); .FirstOrDefault();
} }
} }
if (_target != null) if (_target != null)
{ {
float targetDistance = PowerMath.Distance2D(_target.Position, this.Owner.Position); float targetDistance = PowerMath.Distance2D(_target.Position, Owner.Position);
// if target has moved out of range, deselect it as the target // if target has moved out of range, deselect it as the target
if (targetDistance > MaxTargetRange) if (targetDistance > MaxTargetRange)
@ -91,8 +91,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
else if (targetDistance < _baseAttackRadius + _target.ActorData.Cylinder.Ax2) // run power if within range else if (targetDistance < _baseAttackRadius + _target.ActorData.Cylinder.Ax2) // run power if within range
{ {
// stop any movement // stop any movement
_ownerMover.Move(this.Owner.Position, this.Owner.WalkSpeed); _ownerMover.Move(Owner.Position, Owner.WalkSpeed);
if (this.Owner is Monster) if (Owner is Monster)
{ {
/*(this.Owner as Monster).CorrectedPosition = new Core.Types.Math.Vector3D(this.Owner.Position.X, this.Owner.Position.Y, _target.Position.Z); /*(this.Owner as Monster).CorrectedPosition = new Core.Types.Math.Vector3D(this.Owner.Position.X, this.Owner.Position.Y, _target.Position.Z);
//if() //if()
@ -116,14 +116,14 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
//this.Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = this.Target.DynamicID(plr), Position = this.Target.Position, Snap = false }, this.Target); //this.Target.World.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDTranslateSyncMessage() { ActorId = this.Target.DynamicID(plr), Position = this.Target.Position, Snap = false }, this.Target);
//*/ //*/
this.Owner.World.PowerManager.RunPower(this.Owner, _power, _target, _target.Position); Owner.World.PowerManager.RunPower(Owner, _power, _target, _target.Position);
_powerFinishTimer = new SecondsTickTimer(this.Owner.World.Game, _powerFinishTimer = new SecondsTickTimer(Owner.World.Game,
_power.EvalTag(PowerKeys.AttackSpeed));// + _power.EvalTag(PowerKeys.CooldownTime)); _power.EvalTag(PowerKeys.AttackSpeed));// + _power.EvalTag(PowerKeys.CooldownTime));
_powerRan = true; _powerRan = true;
} }
else else
{ {
this.Done = true; Done = true;
} }
} }
} }
@ -132,9 +132,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Actions
{ {
// TODO: make this per-power instead? // TODO: make this per-power instead?
if (_powerRan) if (_powerRan)
this.Owner.World.PowerManager.CancelAllPowers(this.Owner); Owner.World.PowerManager.CancelAllPowers(Owner);
this.Done = true; Done = true;
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -58,11 +58,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public BossPortal(World world, ActorSno sno, TagMap tags) public BossPortal(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Field2 = 0x9;//16; Field2 = 0x9;//16;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.Attributes[GameAttribute.Untargetable] = false; Attributes[GameAttribute.Untargetable] = false;
var bossEncounter = ((this.ActorSNO.Target as DiIiS_NA.Core.MPQ.FileFormats.Actor).TagMap[MarkerKeys.BossEncounter].Target as DiIiS_NA.Core.MPQ.FileFormats.BossEncounter); var bossEncounter = ((ActorSNO.Target as DiIiS_NA.Core.MPQ.FileFormats.Actor).TagMap[MarkerKeys.BossEncounter].Target as DiIiS_NA.Core.MPQ.FileFormats.BossEncounter);
DestWorld = bossEncounter.Worlds[0]; DestWorld = bossEncounter.Worlds[0];
switch (DestWorld) switch (DestWorld)
{ {
@ -73,7 +73,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
case 109143: case 109143:
DestArea = 109149; break; DestArea = 109149; break;
case 182976: case 182976:
DestArea = 62726; this.Scale = 0.75f; break; DestArea = 62726; Scale = 0.75f; break;
case 159580: case 159580:
DestArea = 58494; break; DestArea = 58494; break;
case 58493: case 58493:
@ -113,83 +113,83 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
} }
DestPoint = bossEncounter.I11; DestPoint = bossEncounter.I11;
//get EncounterSNO //get EncounterSNO
switch (this.SNO) switch (SNO)
{ {
case ActorSno._boss_portal_cainintro: //CainIntro case ActorSno._boss_portal_cainintro: //CainIntro
this.Encounter = 168925; Encounter = 168925;
break; break;
case ActorSno._boss_portal_skeletonking: //Leoric case ActorSno._boss_portal_skeletonking: //Leoric
this.Encounter = 159592; Encounter = 159592;
break; break;
case ActorSno._boss_portal_spiderqueen: //SpiderQueen case ActorSno._boss_portal_spiderqueen: //SpiderQueen
this.Encounter = 181436; Encounter = 181436;
break; break;
case ActorSno._boss_portal_butcher: //Butcher case ActorSno._boss_portal_butcher: //Butcher
this.Encounter = 158915; Encounter = 158915;
break; break;
case ActorSno._boss_portal_maghda: //Maghda case ActorSno._boss_portal_maghda: //Maghda
this.Encounter = 195226; Encounter = 195226;
break; break;
case ActorSno._boss_portal_binkleshulkout: //Cain Death case ActorSno._boss_portal_binkleshulkout: //Cain Death
this.Encounter = 159591; Encounter = 159591;
break; break;
//case 159578: //Belial Audience //case 159578: //Belial Audience
//this.Encounter = 162231; //this.Encounter = 162231;
//break; //break;
case ActorSno._boss_portal_adriasewer: //Adria Rescue case ActorSno._boss_portal_adriasewer: //Adria Rescue
this.Encounter = 159584; Encounter = 159584;
break; break;
case ActorSno._boss_portal_blacksoulstone: //Zoltun Kulle case ActorSno._boss_portal_blacksoulstone: //Zoltun Kulle
this.Encounter = 159586; Encounter = 159586;
break; break;
case ActorSno._boss_portal_belial: //Belial case ActorSno._boss_portal_belial: //Belial
this.Encounter = 159585; Encounter = 159585;
break; break;
case ActorSno._boss_portal_siegebreaker: //SiegeBreaker case ActorSno._boss_portal_siegebreaker: //SiegeBreaker
this.Encounter = 226716; Encounter = 226716;
break; break;
case ActorSno._boss_portal_mistressofpain: //Cydaea case ActorSno._boss_portal_mistressofpain: //Cydaea
this.Encounter = 161246; Encounter = 161246;
break; break;
case ActorSno._boss_portal_azmodan: //Azmodan case ActorSno._boss_portal_azmodan: //Azmodan
this.Encounter = 159582; Encounter = 159582;
break; break;
case ActorSno._boss_portal_adriabetrayal: //Adria_Betrayal case ActorSno._boss_portal_adriabetrayal: //Adria_Betrayal
this.Encounter = 159583; Encounter = 159583;
break; break;
case ActorSno._boss_portal_1000monsterfight: //Iskatu case ActorSno._boss_portal_1000monsterfight: //Iskatu
this.Encounter = 182960; Encounter = 182960;
break; break;
case ActorSno._boss_portal_despair: //Rakanoth case ActorSno._boss_portal_despair: //Rakanoth
this.Encounter = 161247; Encounter = 161247;
break; break;
case ActorSno._bossportal_imperius_spirebase: //Imperius_Spire case ActorSno._bossportal_imperius_spirebase: //Imperius_Spire
this.Encounter = 220541; Encounter = 220541;
break; break;
case ActorSno._boss_portal_diablo: //Diablo case ActorSno._boss_portal_diablo: //Diablo
this.Encounter = 161280; Encounter = 161280;
break; break;
case ActorSno._x1_urzael_bossportal: //Urzael case ActorSno._x1_urzael_bossportal: //Urzael
this.Encounter = 298128; Encounter = 298128;
break; break;
case ActorSno._x1_boss_portal_adria: //Adria case ActorSno._x1_boss_portal_adria: //Adria
this.Encounter = 293007; Encounter = 293007;
break; break;
case ActorSno._x1_boss_portal_batteringram: //BatteringRam case ActorSno._x1_boss_portal_batteringram: //BatteringRam
this.Encounter = 296315; Encounter = 296315;
break; break;
case ActorSno._x1_fortress_malthael_boss_portal: //Malthael case ActorSno._x1_fortress_malthael_boss_portal: //Malthael
this.Encounter = 278965; Encounter = 278965;
break; break;
case ActorSno._boss_portal_greed: case ActorSno._boss_portal_greed:
this.Encounter = 380760; Encounter = 380760;
break; break;
default: default:
this.Encounter = 0; Encounter = 0;
break; break;
} }
this.Destination = new ResolvedPortalDestination Destination = new ResolvedPortalDestination
{ {
WorldSNO = DestWorld, WorldSNO = DestWorld,
DestLevelAreaSNO = DestArea, DestLevelAreaSNO = DestArea,
@ -215,7 +215,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (eventPortals.Contains(this.SNO)) return false; if (eventPortals.Contains(SNO)) return false;
if (!base.Reveal(player)) if (!base.Reveal(player))
return false; return false;
/* /*
@ -232,8 +232,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
//*/ //*/
player.InGameClient.SendMessage(new PortalSpecifierMessage() player.InGameClient.SendMessage(new PortalSpecifierMessage()
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
Destination = this.Destination Destination = Destination
}); });
return true; return true;
} }
@ -245,18 +245,18 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
Logger.Trace("(OnTargeted) BossPortal has been activated, Id: {0}", this.SNO); Logger.Trace("(OnTargeted) BossPortal has been activated, Id: {0}", SNO);
if (this.Encounter == 0) return; if (Encounter == 0) return;
//if (this.World.Game.CurrentEncounter.activated) return; //if (this.World.Game.CurrentEncounter.activated) return;
this.World.Game.CurrentEncounter.activated = true; World.Game.CurrentEncounter.activated = true;
this.World.Game.CurrentEncounter.SnoId = this.Encounter; World.Game.CurrentEncounter.SnoId = Encounter;
foreach (Player plr in this.World.Game.Players.Values) foreach (Player plr in World.Game.Players.Values)
plr.InGameClient.SendMessage(new BossEncounterMessage(Opcodes.BossJoinEncounterMessage) plr.InGameClient.SendMessage(new BossEncounterMessage(Opcodes.BossJoinEncounterMessage)
{ {
PlayerIndex = plr.PlayerIndex, PlayerIndex = plr.PlayerIndex,
snoEncounter = this.Encounter snoEncounter = Encounter
}); });
} }
} }

View File

@ -13,9 +13,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public Environment(World world, ActorSno sno, TagMap tags) public Environment(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Field2 = 0x10;//16; Field2 = 0x10;//16;
this.Field7 = 0x00000000; Field7 = 0x00000000;
this.CollFlags = 1; CollFlags = 1;
} }
} }
} }

View File

@ -24,11 +24,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public Gizmo(World world, ActorSno sno, TagMap tags, bool is_marker = false) public Gizmo(World world, ActorSno sno, TagMap tags, bool is_marker = false)
: base(world, sno, tags, is_marker) : base(world, sno, tags, is_marker)
{ {
this.Field2 = 0x9;//16; Field2 = 0x9;//16;
this.Field7 = 0x00000001; Field7 = 0x00000001;
//this.CollFlags = 1; // this.CollFlags = 0; a hack for passing through blockers /fasbat //this.CollFlags = 1; // this.CollFlags = 0; a hack for passing through blockers /fasbat
if (this.Attributes[GameAttribute.TeamID] == 10) this.Attributes[GameAttribute.TeamID] = 1; //fix for bugged gizmos if (Attributes[GameAttribute.TeamID] == 10) Attributes[GameAttribute.TeamID] = 1; //fix for bugged gizmos
this.Attributes[GameAttribute.Hitpoints_Cur] = 1; Attributes[GameAttribute.Hitpoints_Cur] = 1;
//this.Attributes[GameAttribute.MinimapActive] = true; //this.Attributes[GameAttribute.MinimapActive] = true;
} }
@ -41,20 +41,20 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
if (this.Attributes[GameAttribute.Disabled] == true) return; if (Attributes[GameAttribute.Disabled] == true) return;
Logger.Trace("(OnTargeted) Gizmo has been activated! Id: {0}, Type: {1}", this.SNO, this.ActorData.TagMap[ActorKeys.GizmoGroup]); Logger.Trace("(OnTargeted) Gizmo has been activated! Id: {0}, Type: {1}", SNO, ActorData.TagMap[ActorKeys.GizmoGroup]);
//handling quest triggers //handling quest triggers
if (this.World.Game.QuestProgress.QuestTriggers.ContainsKey((int)this.SNO)) if (World.Game.QuestProgress.QuestTriggers.ContainsKey((int)SNO))
{ {
var trigger = this.World.Game.QuestProgress.QuestTriggers[(int)this.SNO]; var trigger = World.Game.QuestProgress.QuestTriggers[(int)SNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor)
{ {
this.World.Game.QuestProgress.UpdateCounter((int)this.SNO); World.Game.QuestProgress.UpdateCounter((int)SNO);
if (trigger.count == this.World.Game.QuestProgress.QuestTriggers[(int)this.SNO].counter) if (trigger.count == World.Game.QuestProgress.QuestTriggers[(int)SNO].counter)
try try
{ {
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
catch (Exception e) catch (Exception e)
{ {
@ -62,27 +62,27 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
} }
} }
} }
else if (this.World.Game.SideQuestProgress.QuestTriggers.ContainsKey((int)this.SNO)) else if (World.Game.SideQuestProgress.QuestTriggers.ContainsKey((int)SNO))
{ {
var trigger = this.World.Game.SideQuestProgress.QuestTriggers[(int)this.SNO]; var trigger = World.Game.SideQuestProgress.QuestTriggers[(int)SNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor)
{ {
this.World.Game.SideQuestProgress.UpdateSideCounter((int)this.SNO); World.Game.SideQuestProgress.UpdateSideCounter((int)SNO);
if (trigger.count == this.World.Game.SideQuestProgress.QuestTriggers[(int)this.SNO].counter) if (trigger.count == World.Game.SideQuestProgress.QuestTriggers[(int)SNO].counter)
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
} }
if (this.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey((int)this.SNO)) if (World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey((int)SNO))
{ {
var trigger = this.World.Game.SideQuestProgress.GlobalQuestTriggers[(int)this.SNO]; var trigger = World.Game.SideQuestProgress.GlobalQuestTriggers[(int)SNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor)
{ {
this.World.Game.SideQuestProgress.UpdateGlobalCounter((int)this.SNO); World.Game.SideQuestProgress.UpdateGlobalCounter((int)SNO);
if (trigger.count == this.World.Game.SideQuestProgress.GlobalQuestTriggers[(int)this.SNO].counter) if (trigger.count == World.Game.SideQuestProgress.GlobalQuestTriggers[(int)SNO].counter)
try try
{ {
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
this.World.Game.SideQuestProgress.GlobalQuestTriggers.Remove((int)this.SNO); World.Game.SideQuestProgress.GlobalQuestTriggers.Remove((int)SNO);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -13,8 +13,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem
public HandledSNOAttribute(params ActorSno[] snoIds) public HandledSNOAttribute(params ActorSno[] snoIds)
{ {
this.SNOIds = new List<ActorSno>(); SNOIds = new List<ActorSno>();
this.SNOIds.AddRange(snoIds); SNOIds.AddRange(snoIds);
} }
} }
} }

View File

@ -29,14 +29,14 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public Artisan(World world, ActorSno sno, TagMap tags) public Artisan(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
Interactions.Add(new CraftInteraction()); Interactions.Add(new CraftInteraction());
//Interactions.Add(new IdentifyAllInteraction()); //Interactions.Add(new IdentifyAllInteraction());
} }
public override void OnCraft(Player player) public override void OnCraft(Player player)
{ {
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
//player.InGameClient.SendMessage(new OpenArtisanWindowMessage() { ArtisanID = this.DynamicID(player) }); //player.InGameClient.SendMessage(new OpenArtisanWindowMessage() { ArtisanID = this.DynamicID(player) });
} }

View File

@ -53,8 +53,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Misc.ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Misc.ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
switch (this.SNO) switch (SNO)
{ {
case ActorSno._pt_blacksmith_repairshortcut: case ActorSno._pt_blacksmith_repairshortcut:
case ActorSno._pt_blacksmith_forgeweaponshortcut: case ActorSno._pt_blacksmith_forgeweaponshortcut:
@ -74,9 +74,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.World.Game.CurrentAct != 3000) if (World.Game.CurrentAct != 3000)
{ {
switch (this.SNO) switch (SNO)
{ {
case ActorSno._pt_blacksmith_repairshortcut: case ActorSno._pt_blacksmith_repairshortcut:
case ActorSno._pt_blacksmith_forgeweaponshortcut: case ActorSno._pt_blacksmith_forgeweaponshortcut:

View File

@ -35,7 +35,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override void OnCraft(Player player) public override void OnCraft(Player player)
{ {
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
player.ArtisanInteraction = "Blacksmith"; player.ArtisanInteraction = "Blacksmith";
} }

View File

@ -22,7 +22,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
{ {
} }
public void OnAddSocket(PlayerSystem.Player player, Item item) public void OnAddSocket(Player player, Item item)
{ {
// TODO: Animate Jeweler? Who knows. /fasbat // TODO: Animate Jeweler? Who knows. /fasbat
item.Attributes[GameAttribute.Sockets] += 1; item.Attributes[GameAttribute.Sockets] += 1;
@ -32,7 +32,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override void OnCraft(Player player) public override void OnCraft(Player player)
{ {
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
player.ArtisanInteraction = "Jeweler"; player.ArtisanInteraction = "Jeweler";
} }

View File

@ -24,7 +24,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override void OnCraft(Player player) public override void OnCraft(Player player)
{ {
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
player.ArtisanInteraction = "Mystic"; player.ArtisanInteraction = "Mystic";
} }

View File

@ -22,24 +22,24 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public Nephalem(World world, ActorSno sno, TagMap tags) public Nephalem(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.NPC_Is_Operatable] = true; Attributes[GameAttribute.NPC_Is_Operatable] = true;
this.Attributes[GameAttribute.Is_NPC] = true; Attributes[GameAttribute.Is_NPC] = true;
this.Attributes[GameAttribute.In_Tiered_Loot_Run_Level] = 0; Attributes[GameAttribute.In_Tiered_Loot_Run_Level] = 0;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.Attributes[GameAttribute.NPC_Has_Interact_Options, 0] = true; Attributes[GameAttribute.NPC_Has_Interact_Options, 0] = true;
this.Attributes[GameAttribute.NPC_Has_Interact_Options, 1] = true; Attributes[GameAttribute.NPC_Has_Interact_Options, 1] = true;
this.Attributes[GameAttribute.NPC_Has_Interact_Options, 2] = true; Attributes[GameAttribute.NPC_Has_Interact_Options, 2] = true;
this.Attributes[GameAttribute.NPC_Has_Interact_Options, 3] = true; Attributes[GameAttribute.NPC_Has_Interact_Options, 3] = true;
//this.Attributes[GameAttribute.Conversation_Icon] = 2; //this.Attributes[GameAttribute.Conversation_Icon] = 2;
//this.ForceConversationSNO = //this.ForceConversationSNO =
} }
public override void OnCraft(Player player) public override void OnCraft(Player player)
{ {
if (this.World.Game.ActiveNephalemKilledBoss == true) if (World.Game.ActiveNephalemKilledBoss == true)
{ {
this.World.Game.ActiveNephalemKilledBoss = false; World.Game.ActiveNephalemKilledBoss = false;
foreach (var plr in this.World.Game.Players.Values) foreach (var plr in World.Game.Players.Values)
{ {
plr.InGameClient.SendMessage(new QuestCounterMessage() plr.InGameClient.SendMessage(new QuestCounterMessage()
{ {
@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
} }
} }
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
player.ArtisanInteraction = "Mystic"; player.ArtisanInteraction = "Mystic";
} }

View File

@ -32,7 +32,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
if (world.Game.CurrentAct == 3000) if (world.Game.CurrentAct == 3000)
{ {
this.Conversations.Add(new ConversationInteraction(430146)); Conversations.Add(new ConversationInteraction(430146));
//[430335] [Worlds] a3dun_ruins_frost_city_a_02 //[430335] [Worlds] a3dun_ruins_frost_city_a_02
//[428493] [Worlds] a3dun_ruins_frost_city_a_01 //[428493] [Worlds] a3dun_ruins_frost_city_a_01
//this.Attributes[GameAttribute.Conversation_Icon, 0] = 1; //this.Attributes[GameAttribute.Conversation_Icon, 0] = 1;
@ -48,7 +48,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.SNO == ActorSno._kanaicube_stand) if (SNO == ActorSno._kanaicube_stand)
if (!player.KanaiUnlocked) if (!player.KanaiUnlocked)
Interactions.Clear(); Interactions.Clear();
else else
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Artisans
public override void OnTargeted(Player player, MessageSystem.Message.Definitions.World.TargetMessage message) public override void OnTargeted(Player player, MessageSystem.Message.Definitions.World.TargetMessage message)
{ {
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Misc.ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = this.DynamicID(player) }); player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Misc.ANNDataMessage(Opcodes.OpenArtisanWindowMessage) { ActorID = DynamicID(player) });
player.ArtisanInteraction = "Cube"; player.ArtisanInteraction = "Cube";
} }
} }

View File

@ -49,7 +49,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public Banner(World world, ActorSno sno, TagMap tags) public Banner(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.BannerPlayerIndex = bannerActors.FirstOrDefault(x => x.Value.Contains(this.SNO)).Key; BannerPlayerIndex = bannerActors.FirstOrDefault(x => x.Value.Contains(SNO)).Key;
} }
public int BannerPlayerIndex = 0; public int BannerPlayerIndex = 0;
@ -63,13 +63,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
Logger.Trace("(OnTargeted) Banner has been activated "); Logger.Trace("(OnTargeted) Banner has been activated ");
if (this.World.Game.Players.Count == 1 || this.BannerPlayerIndex == 0) if (World.Game.Players.Count == 1 || BannerPlayerIndex == 0)
{ {
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Base.SimpleMessage(Opcodes.OpenBannerCustomizationMessage)); player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Base.SimpleMessage(Opcodes.OpenBannerCustomizationMessage));
return; return;
} }
var banner_player = this.World.Game.Players.Values.Single(p => p.PlayerIndex == this.BannerPlayerIndex); var banner_player = World.Game.Players.Values.Single(p => p.PlayerIndex == BannerPlayerIndex);
if (banner_player == null || banner_player.World == null) if (banner_player == null || banner_player.World == null)
{ {
@ -78,23 +78,23 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
} }
//if banner has been disabled for events like active greater active swarm /advocaite //if banner has been disabled for events like active greater active swarm /advocaite
if(!player.Attributes[GameAttributeB.Banner_Usable]) if(!player.Attributes[GameAttribute.Banner_Usable])
{ {
return; return;
} }
player.ShowConfirmation(this.DynamicID(player), (() => { player.ShowConfirmation(DynamicID(player), (() => {
player.StartCasting(150, new Action(() => { player.StartCasting(150, new Action(() => {
if (banner_player.PlayerDirectBanner == null) if (banner_player.PlayerDirectBanner == null)
{ {
if (banner_player.World == this.World) if (banner_player.World == World)
player.Teleport(banner_player.Position); player.Teleport(banner_player.Position);
else else
player.ChangeWorld(banner_player.World, banner_player.Position); player.ChangeWorld(banner_player.World, banner_player.Position);
} }
else else
{ {
if (banner_player.PlayerDirectBanner.World == this.World) if (banner_player.PlayerDirectBanner.World == World)
player.Teleport(banner_player.PlayerDirectBanner.Position); player.Teleport(banner_player.PlayerDirectBanner.Position);
else else
player.ChangeWorld(banner_player.PlayerDirectBanner.World, banner_player.PlayerDirectBanner.Position); player.ChangeWorld(banner_player.PlayerDirectBanner.World, banner_player.PlayerDirectBanner.Position);

View File

@ -77,19 +77,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public Boss(MapSystem.World world, ActorSno sno, TagMap tags) public Boss(MapSystem.World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
if (sno == ActorSno._zoltunkulle && world.SNO == WorldSno.a2dun_zolt_lobby) this.SetVisible(false); if (sno == ActorSno._zoltunkulle && world.SNO == WorldSno.a2dun_zolt_lobby) SetVisible(false);
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
//this.Attributes[GameAttribute.Immune_To_Charm] = true; //this.Attributes[GameAttribute.Immune_To_Charm] = true;
this.Attributes[GameAttribute.//Blizzless Project 2022 Attributes[GameAttribute.//Blizzless Project 2022
using_Bossbar] = true; using_Bossbar] = true;
this.Attributes[GameAttribute.InBossEncounter] = true; Attributes[GameAttribute.InBossEncounter] = true;
this.Attributes[GameAttribute.Hitpoints_Max] *= 10.0f; Attributes[GameAttribute.Hitpoints_Max] *= 10.0f;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 7.8f; Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 7.8f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 7.8f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 7.8f;
this.Attributes[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Max_Total]; Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
this.Attributes[GameAttribute.TeamID] = 10; Attributes[GameAttribute.TeamID] = 10;
this.WalkSpeed *= 0.5f; WalkSpeed *= 0.5f;
MonsterBrain monsterBrain = (Brain as MonsterBrain); MonsterBrain monsterBrain = (Brain as MonsterBrain);
switch (sno) switch (sno)
{ {
@ -167,7 +167,7 @@ using_Bossbar] = true;
monsterBrain.AddPresetPower(83008); monsterBrain.AddPresetPower(83008);
break; break;
case ActorSno._belial_trueform://Belial (small) case ActorSno._belial_trueform://Belial (small)
this.HasLoot = false; HasLoot = false;
break; break;
case ActorSno._belial://Belial (big) case ActorSno._belial://Belial (big)
monsterBrain.AddPresetPower(152540); monsterBrain.AddPresetPower(152540);
@ -203,9 +203,9 @@ using_Bossbar] = true;
public override bool Reveal(PlayerSystem.Player player) public override bool Reveal(PlayerSystem.Player player)
{ {
if (this.SNO == ActorSno._terrordemon_a_unique_1000monster) if (SNO == ActorSno._terrordemon_a_unique_1000monster)
{ {
this.Destroy(); Destroy();
return false; return false;
} }

View File

@ -18,16 +18,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public CR_Glass(MapSystem.World world, ActorSno sno, TagMap tags) public CR_Glass(MapSystem.World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.TeamID] = 2; Attributes[GameAttribute.TeamID] = 2;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
} }
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage46) player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage46)
{ {
ActorID = this.DynamicID(player) ActorID = DynamicID(player)
}); });
} }
} }

View File

@ -36,19 +36,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public void ReceiveDamage(Actor source, float damage) public void ReceiveDamage(Actor source, float damage)
{ {
if (this.SNO == ActorSno._trout_highlands_goatman_totem_gharbad && this.World.Game.CurrentSideQuest != 225253) return; if (SNO == ActorSno._trout_highlands_goatman_totem_gharbad && World.Game.CurrentSideQuest != 225253) return;
World.BroadcastIfRevealed(plr => new FloatingNumberMessage World.BroadcastIfRevealed(plr => new FloatingNumberMessage
{ {
Number = damage, Number = damage,
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
Type = FloatingNumberMessage.FloatType.White Type = FloatingNumberMessage.FloatType.White
}, this); }, this);
Attributes[GameAttribute.Hitpoints_Cur] = Math.Max(Attributes[GameAttribute.Hitpoints_Cur] - damage, 0); Attributes[GameAttribute.Hitpoints_Cur] = Math.Max(Attributes[GameAttribute.Hitpoints_Cur] - damage, 0);
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !this.SNO.IsUndestroyable()) if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !SNO.IsUndestroyable())
Die(source); Die(source);
} }
@ -56,12 +56,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
base.OnTargeted(null, null); base.OnTargeted(null, null);
Logger.Trace("Breaked barricade, id: {0}", this.SNO); Logger.Trace("Breaked barricade, id: {0}", SNO);
if (this.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimReason = 11, AnimReason = 11,
UnitAniimStartTime = 0, UnitAniimStartTime = 0,
tAnim = new PlayAnimationMessageSpec[] tAnim = new PlayAnimationMessageSpec[]
@ -78,19 +78,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
}, this); }, this);
this.Attributes[GameAttribute.Deleted_On_Server] = true; Attributes[GameAttribute.Deleted_On_Server] = true;
this.Attributes[GameAttribute.Could_Have_Ragdolled] = true; Attributes[GameAttribute.Could_Have_Ragdolled] = true;
this.Attributes[GameAttribute.Attacks_Per_Second] = 1.0f; Attributes[GameAttribute.Attacks_Per_Second] = 1.0f;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] = 5f; Attributes[GameAttribute.Damage_Weapon_Min, 0] = 5f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
Task.Delay(1500).ContinueWith(delegate Task.Delay(1500).ContinueWith(delegate
{ {
this.World.PowerManager.RunPower(this, 30209); World.PowerManager.RunPower(this, 30209);
var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[GameServer.Core.Types.SNO.SNOGroup.Anim][10217].Data; var DataOfSkill = DiIiS_NA.Core.MPQ.MPQStorage.Data.Assets[Core.Types.SNO.SNOGroup.Anim][10217].Data;
this.Destroy(); Destroy();
}); });
} }

View File

@ -35,19 +35,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public void ReceiveDamage(Actor source, float damage) public void ReceiveDamage(Actor source, float damage)
{ {
if (this.SNO == ActorSno._trout_highlands_goatman_totem_gharbad && this.World.Game.CurrentSideQuest != 225253) return; if (SNO == ActorSno._trout_highlands_goatman_totem_gharbad && World.Game.CurrentSideQuest != 225253) return;
World.BroadcastIfRevealed(plr => new FloatingNumberMessage World.BroadcastIfRevealed(plr => new FloatingNumberMessage
{ {
Number = damage, Number = damage,
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
Type = FloatingNumberMessage.FloatType.White Type = FloatingNumberMessage.FloatType.White
}, this); }, this);
Attributes[GameAttribute.Hitpoints_Cur] = Math.Max(Attributes[GameAttribute.Hitpoints_Cur] - damage, 0); Attributes[GameAttribute.Hitpoints_Cur] = Math.Max(Attributes[GameAttribute.Hitpoints_Cur] - damage, 0);
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !this.SNO.IsUndestroyable()) if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !SNO.IsUndestroyable())
Die(source); Die(source);
} }
@ -55,12 +55,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
base.OnTargeted(null, null); base.OnTargeted(null, null);
Logger.Trace("Breaked barricade, id: {0}", this.SNO); Logger.Trace("Breaked barricade, id: {0}", SNO);
if (this.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimReason = 11, AnimReason = 11,
UnitAniimStartTime = 0, UnitAniimStartTime = 0,
tAnim = new PlayAnimationMessageSpec[] tAnim = new PlayAnimationMessageSpec[]
@ -77,17 +77,17 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
}, this); }, this);
this.Attributes[GameAttribute.Deleted_On_Server] = true; Attributes[GameAttribute.Deleted_On_Server] = true;
this.Attributes[GameAttribute.Could_Have_Ragdolled] = true; Attributes[GameAttribute.Could_Have_Ragdolled] = true;
this.Attributes[GameAttribute.Attacks_Per_Second] = 1.0f; Attributes[GameAttribute.Attacks_Per_Second] = 1.0f;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] = 5f; Attributes[GameAttribute.Damage_Weapon_Min, 0] = 5f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
Task.Delay(1400).ContinueWith(delegate Task.Delay(1400).ContinueWith(delegate
{ {
this.World.PowerManager.RunPower(this, 186216); World.PowerManager.RunPower(this, 186216);
this.Destroy(); Destroy();
}); });
} }

View File

@ -32,16 +32,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public ChallengeObelisk(World world, ActorSno sno, TagMap tags) public ChallengeObelisk(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.TeamID] = 2; Attributes[GameAttribute.TeamID] = 2;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
} }
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
bool Activated = false; bool Activated = false;
this.PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2); Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
Attributes[GameAttribute.Untargetable] = !Activated; Attributes[GameAttribute.Untargetable] = !Activated;
Attributes[GameAttribute.NPC_Is_Operatable] = Activated; Attributes[GameAttribute.NPC_Is_Operatable] = Activated;
@ -52,11 +52,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
CollFlags = 0; CollFlags = 0;
TickTimer Timeout = new SecondsTickTimer(this.World.Game, 3.5f); TickTimer Timeout = new SecondsTickTimer(World.Game, 3.5f);
var Boom = Task<bool>.Factory.StartNew(() => WaitToSpawn(Timeout)); var Boom = Task<bool>.Factory.StartNew(() => WaitToSpawn(Timeout));
Boom.ContinueWith(delegate Boom.ContinueWith(delegate
{ {
var actor = this.World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal); var actor = World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal);
actor.SetVisible(true); actor.SetVisible(true);
actor.Reveal(player); actor.Reveal(player);
@ -75,13 +75,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
return false; return false;
if (!Attributes[GameAttribute.Operatable]) if (!Attributes[GameAttribute.Operatable])
{ {
var actor = this.World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal); var actor = World.GetActorBySNO(ActorSno._x1_openworld_challenge_rifts_portal);
actor.SetVisible(false); actor.SetVisible(false);
actor.Unreveal(player); actor.Unreveal(player);
} }
else else
{ {
this.PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]); PlayAnimation(5, AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
} }
return true; return true;
} }

View File

@ -23,18 +23,18 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public Champion(MapSystem.World world, ActorSno sno, TagMap tags) public Champion(MapSystem.World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.Hitpoints_Max] *= 4.0f; Attributes[GameAttribute.Hitpoints_Max] *= 4.0f;
this.Attributes[GameAttribute.Immune_To_Charm] = true; Attributes[GameAttribute.Immune_To_Charm] = true;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 2.5f; Attributes[GameAttribute.Damage_Weapon_Min, 0] *= 2.5f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 2.5f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] *= 2.5f;
this.Attributes[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Max_Total]; Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
//MonsterAffixGenerator.Generate(this, this.World.Game.Difficulty + 1); //MonsterAffixGenerator.Generate(this, this.World.Game.Difficulty + 1);
this.Attributes[GameAttribute.Movement_Scalar] = this.Attributes[GameAttribute.Movement_Scalar] * 0.5f; Attributes[GameAttribute.Movement_Scalar] = Attributes[GameAttribute.Movement_Scalar] * 0.5f;
this.Attributes[GameAttribute.Run_Speed_Granted] = this.Attributes[GameAttribute.Run_Speed_Granted] * 0.5f; Attributes[GameAttribute.Run_Speed_Granted] = Attributes[GameAttribute.Run_Speed_Granted] * 0.5f;
this.Attributes[GameAttribute.Movement_Scalar_Reduction_Percent] -= 20f; Attributes[GameAttribute.Movement_Scalar_Reduction_Percent] -= 20f;
this.WalkSpeed = 0.3f; WalkSpeed = 0.3f;
this.NamePrefix = MonsterAffixGenerator.GeneratePrefixName(); NamePrefix = MonsterAffixGenerator.GeneratePrefixName();
this.NameSuffix = MonsterAffixGenerator.GenerateSuffixName(); NameSuffix = MonsterAffixGenerator.GenerateSuffixName();
} }
@ -51,7 +51,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
player.InGameClient.SendMessage(new RareMonsterNamesMessage() player.InGameClient.SendMessage(new RareMonsterNamesMessage()
{ {
ann = DynamicID(player), ann = DynamicID(player),
RareNames = new int[2] { this.NamePrefix, this.NameSuffix }, RareNames = new int[2] { NamePrefix, NameSuffix },
MonsterAffixes = affixGbids MonsterAffixes = affixGbids
}); });

View File

@ -22,8 +22,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override void OnPlayerApproaching(PlayerSystem.Player player) public override void OnPlayerApproaching(PlayerSystem.Player player)
{ {
if (this.World.Game.PvP) return; if (World.Game.PvP) return;
if (player.Position.DistanceSquared(ref _position) < ActorData.Sphere.Radius * ActorData.Sphere.Radius * this.Scale * this.Scale && !_checkpointReached) if (player.Position.DistanceSquared(ref _position) < ActorData.Sphere.Radius * ActorData.Sphere.Radius * Scale * Scale && !_checkpointReached)
{ {
_checkpointReached = true; _checkpointReached = true;
@ -33,7 +33,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Effect = Effect.Checkpoint Effect = Effect.Checkpoint
}); });
player.CheckPointPosition = this.Position; player.CheckPointPosition = Position;
player.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 3; // Reset corpse resurrection charges player.Attributes[GameAttribute.Corpse_Resurrection_Charges] = 3; // Reset corpse resurrection charges
} }
} }

View File

@ -33,12 +33,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
try try
{ {
if (player.Position.DistanceSquared(ref _position) < 225f && !_collapsed && this.Randomed) if (player.Position.DistanceSquared(ref _position) < 225f && !_collapsed && Randomed)
{ {
_collapsed = true; _collapsed = true;
this.World.Game.SideQuestGizmo = this; World.Game.SideQuestGizmo = this;
this.World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true); World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true);
} }
} }
catch { } catch { }
@ -56,7 +56,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public void Activate() public void Activate()
{ {
var rewardChests = this.GetActorsInRange<LootContainer>(20f).Where(c => c.rewardChestAvailable == false).ToList(); var rewardChests = GetActorsInRange<LootContainer>(20f).Where(c => c.rewardChestAvailable == false).ToList();
foreach (var chest in rewardChests) foreach (var chest in rewardChests)
{ {
@ -65,7 +65,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
chest.Reveal(plr); chest.Reveal(plr);
} }
this.Destroy(); Destroy();
} }
} }
} }

View File

@ -37,12 +37,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
try try
{ {
if (player.Position.DistanceSquared(ref _position) < 225f && !_collapsed && this.Randomed) if (player.Position.DistanceSquared(ref _position) < 225f && !_collapsed && Randomed)
{ {
_collapsed = true; _collapsed = true;
this.World.Game.SideQuestGizmo = this; World.Game.SideQuestGizmo = this;
this.World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true); World.Game.QuestManager.LaunchSideQuest(eventIds[DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, eventIds.Count())], true);
} }
} }
catch { } catch { }
@ -60,51 +60,51 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public void Activate() public void Activate()
{ {
this.World.BroadcastIfRevealed(plr => new ANNDataMessage(Opcodes.ShrineActivatedMessage) { ActorID = this.DynamicID(plr) }, this); World.BroadcastIfRevealed(plr => new ANNDataMessage(Opcodes.ShrineActivatedMessage) { ActorID = DynamicID(plr) }, this);
var type = DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, 4); var type = DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.Next(0, 4);
switch (type) switch (type)
{ {
case 0: //blessed case 0: //blessed
foreach (var plr in this.GetPlayersInRange(100f)) foreach (var plr in GetPlayersInRange(100f))
{ {
this.World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineBlessedBuff(TickTimer.WaitSeconds(this.World.Game, 120.0f))); World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineBlessedBuff(TickTimer.WaitSeconds(World.Game, 120.0f)));
plr.GrantCriteria(74987243307423); plr.GrantCriteria(74987243307423);
} }
break; break;
case 1: //enlightened case 1: //enlightened
foreach (var plr in this.GetPlayersInRange(100f)) foreach (var plr in GetPlayersInRange(100f))
{ {
this.World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineEnlightenedBuff(TickTimer.WaitSeconds(this.World.Game, 120.0f))); World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineEnlightenedBuff(TickTimer.WaitSeconds(World.Game, 120.0f)));
plr.GrantCriteria(74987243307424); plr.GrantCriteria(74987243307424);
} }
break; break;
case 2: //fortune case 2: //fortune
foreach (var plr in this.GetPlayersInRange(100f)) foreach (var plr in GetPlayersInRange(100f))
{ {
this.World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineFortuneBuff(TickTimer.WaitSeconds(this.World.Game, 120.0f))); World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineFortuneBuff(TickTimer.WaitSeconds(World.Game, 120.0f)));
plr.GrantCriteria(74987243307425); plr.GrantCriteria(74987243307425);
} }
break; break;
case 3: //frenzied case 3: //frenzied
foreach (var plr in this.GetPlayersInRange(100f)) foreach (var plr in GetPlayersInRange(100f))
{ {
this.World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineFrenziedBuff(TickTimer.WaitSeconds(this.World.Game, 120.0f))); World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineFrenziedBuff(TickTimer.WaitSeconds(World.Game, 120.0f)));
plr.GrantCriteria(74987243307426); plr.GrantCriteria(74987243307426);
} }
break; break;
default: default:
foreach (var plr in this.GetPlayersInRange(100f)) foreach (var plr in GetPlayersInRange(100f))
{ {
this.World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineEnlightenedBuff(TickTimer.WaitSeconds(this.World.Game, 120.0f))); World.BuffManager.AddBuff(this, plr, new PowerSystem.Implementations.ShrineEnlightenedBuff(TickTimer.WaitSeconds(World.Game, 120.0f)));
} }
break; break;
} }
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
//this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); //this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Gizmo_State] = 1; Attributes[GameAttribute.Gizmo_State] = 1;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
var rewardChests = this.GetActorsInRange<LootContainer>(20f).Where(c => c.rewardChestAvailable == false).ToList(); var rewardChests = GetActorsInRange<LootContainer>(20f).Where(c => c.rewardChestAvailable == false).ToList();
foreach (var chest in rewardChests) foreach (var chest in rewardChests)
{ {

View File

@ -51,12 +51,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public void ReceiveDamage(Actor source, float damage /* critical, type */) public void ReceiveDamage(Actor source, float damage /* critical, type */)
{ {
if (this.SNO == ActorSno._trout_highlands_goatman_totem_gharbad && this.World.Game.CurrentSideQuest != 225253) return; if (SNO == ActorSno._trout_highlands_goatman_totem_gharbad && World.Game.CurrentSideQuest != 225253) return;
World.BroadcastIfRevealed(plr => new FloatingNumberMessage World.BroadcastIfRevealed(plr => new FloatingNumberMessage
{ {
Number = damage, Number = damage,
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
Type = FloatingNumberMessage.FloatType.White Type = FloatingNumberMessage.FloatType.White
}, this); }, this);
@ -65,7 +65,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !this.SNO.IsUndestroyable()) if (Attributes[GameAttribute.Hitpoints_Cur] == 0 && !SNO.IsUndestroyable())
{ {
Die(source); Die(source);
} }
@ -76,40 +76,40 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
base.OnTargeted(null, null); base.OnTargeted(null, null);
if (haveDrop) if (haveDrop)
{ {
var dropRates = this.World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)this.Quality, 70) : LootManager.GetDropRates((int)this.Quality, 70); var dropRates = World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)Quality, 70) : LootManager.GetDropRates((int)Quality, 70);
foreach (var rate in dropRates) foreach (var rate in dropRates)
foreach (var plr in this.GetPlayersInRange(30)) foreach (var plr in GetPlayersInRange(30))
{ {
float seed = (float)FastRandom.Instance.NextDouble(); float seed = (float)FastRandom.Instance.NextDouble();
if (seed < 0.95f) if (seed < 0.95f)
this.World.SpawnGold(this, plr); World.SpawnGold(this, plr);
if (seed < 0.06f) if (seed < 0.06f)
this.World.SpawnRandomCraftItem(this, plr); World.SpawnRandomCraftItem(this, plr);
if (seed < 0.04f) if (seed < 0.04f)
this.World.SpawnRandomGem(this, plr); World.SpawnRandomGem(this, plr);
if (seed < 0.10f) if (seed < 0.10f)
this.World.SpawnRandomPotion(this, plr); World.SpawnRandomPotion(this, plr);
if (seed < (rate * (1f + plr.Attributes[GameAttribute.Magic_Find]))) if (seed < (rate * (1f + plr.Attributes[GameAttribute.Magic_Find])))
{ {
var lootQuality = this.World.Game.IsHardcore ? LootManager.GetSeasonalLootQuality((int)this.Quality, this.World.Game.Difficulty) : LootManager.GetLootQuality((int)this.Quality, this.World.Game.Difficulty); var lootQuality = World.Game.IsHardcore ? LootManager.GetSeasonalLootQuality((int)Quality, World.Game.Difficulty) : LootManager.GetLootQuality((int)Quality, World.Game.Difficulty);
this.World.SpawnRandomEquip(plr, plr, lootQuality); World.SpawnRandomEquip(plr, plr, lootQuality);
} }
else else
break; break;
} }
} }
Logger.Trace("Breaked barricade, id: {0}", this.SNO); Logger.Trace("Breaked barricade, id: {0}", SNO);
if (source != null && source is Player && tombs.Contains(this.SNO)) if (source != null && source is Player && tombs.Contains(SNO))
{ {
(source as Player).AddAchievementCounter(74987243307171, 1); (source as Player).AddAchievementCounter(74987243307171, 1);
} }
if (this.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault)) if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimReason = 11, AnimReason = 11,
UnitAniimStartTime = 0, UnitAniimStartTime = 0,
tAnim = new PlayAnimationMessageSpec[] tAnim = new PlayAnimationMessageSpec[]
@ -126,38 +126,38 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
}, this); }, this);
this.Attributes[GameAttribute.Deleted_On_Server] = true; Attributes[GameAttribute.Deleted_On_Server] = true;
this.Attributes[GameAttribute.Could_Have_Ragdolled] = true; Attributes[GameAttribute.Could_Have_Ragdolled] = true;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
//handling quest triggers //handling quest triggers
if (this.World.Game.QuestProgress.QuestTriggers.ContainsKey((int)this.SNO)) if (World.Game.QuestProgress.QuestTriggers.ContainsKey((int)SNO))
{ {
var trigger = this.World.Game.QuestProgress.QuestTriggers[(int)this.SNO]; var trigger = World.Game.QuestProgress.QuestTriggers[(int)SNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillMonster) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillMonster)
{ {
this.World.Game.QuestProgress.UpdateCounter((int)this.SNO); World.Game.QuestProgress.UpdateCounter((int)SNO);
if (trigger.count == this.World.Game.QuestProgress.QuestTriggers[(int)this.SNO].counter) if (trigger.count == World.Game.QuestProgress.QuestTriggers[(int)SNO].counter)
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
else else
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.MonsterFromGroup) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.MonsterFromGroup)
{ {
this.World.Game.QuestProgress.UpdateCounter((int)this.SNO); World.Game.QuestProgress.UpdateCounter((int)SNO);
} }
} }
else if (this.World.Game.SideQuestProgress.QuestTriggers.ContainsKey((int)this.SNO)) else if (World.Game.SideQuestProgress.QuestTriggers.ContainsKey((int)SNO))
{ {
var trigger = this.World.Game.SideQuestProgress.QuestTriggers[(int)this.SNO]; var trigger = World.Game.SideQuestProgress.QuestTriggers[(int)SNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillMonster) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.KillMonster)
{ {
this.World.Game.SideQuestProgress.UpdateSideCounter((int)this.SNO); World.Game.SideQuestProgress.UpdateSideCounter((int)SNO);
if (trigger.count == this.World.Game.SideQuestProgress.QuestTriggers[(int)this.SNO].counter) if (trigger.count == World.Game.SideQuestProgress.QuestTriggers[(int)SNO].counter)
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
} }
this.Destroy(); Destroy();
} }

View File

@ -42,31 +42,31 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (NearestPortal != null) if (NearestPortal != null)
{ {
NearestPortal.SetVisible(false); NearestPortal.SetVisible(false);
foreach (var plr in this.World.Players.Values) foreach (var plr in World.Players.Values)
NearestPortal.Unreveal(plr); NearestPortal.Unreveal(plr);
} }
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.SNO == ActorSno._trout_cultists_summoning_portal_b) return false; if (SNO == ActorSno._trout_cultists_summoning_portal_b) return false;
if (this.SNO == ActorSno._a2dun_aqd_godhead_door_largepuzzle && this.World.SNO != WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //dakab door if (SNO == ActorSno._a2dun_aqd_godhead_door_largepuzzle && World.SNO != WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //dakab door
if (this.SNO == ActorSno._a2dun_aqd_godhead_door && this.World.SNO == WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //not dakab door if (SNO == ActorSno._a2dun_aqd_godhead_door && World.SNO == WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //not dakab door
if (this.SNO == ActorSno._a2dun_zolt_random_portal_timed) //Treasure Room door if (SNO == ActorSno._a2dun_zolt_random_portal_timed) //Treasure Room door
this.isOpened = true; isOpened = true;
if (this.SNO == ActorSno._caout_oasis_mine_entrance_a && (float)DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.NextDouble() < 0.3f) //Mysterious Cave door if (SNO == ActorSno._caout_oasis_mine_entrance_a && (float)DiIiS_NA.Core.Helpers.Math.FastRandom.Instance.NextDouble() < 0.3f) //Mysterious Cave door
this.isOpened = true; isOpened = true;
if (!base.Reveal(player)) if (!base.Reveal(player))
return false; return false;
if (this.isOpened == true) if (isOpened == true)
{ {
player.InGameClient.SendMessage(new SetIdleAnimationMessage player.InGameClient.SendMessage(new SetIdleAnimationMessage
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
AnimationSNO = AnimationSetKeys.Open.ID AnimationSNO = AnimationSetKeys.Open.ID
}); });
} }
@ -79,7 +79,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (NearestPortal != null) if (NearestPortal != null)
{ {
NearestPortal.SetVisible(false); NearestPortal.SetVisible(false);
foreach (var plr in this.World.Players.Values) foreach (var plr in World.Players.Values)
NearestPortal.Unreveal(plr); NearestPortal.Unreveal(plr);
} }
} }
@ -90,7 +90,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
World.BroadcastIfRevealed(plr => new PlayAnimationMessage World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimReason = 5, AnimReason = 5,
UnitAniimStartTime = 0, UnitAniimStartTime = 0,
tAnim = new PlayAnimationMessageSpec[] tAnim = new PlayAnimationMessageSpec[]
@ -115,24 +115,24 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
World.BroadcastIfRevealed(plr => new SetIdleAnimationMessage World.BroadcastIfRevealed(plr => new SetIdleAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimationSNO = AnimationSetKeys.Open.ID AnimationSNO = AnimationSetKeys.Open.ID
}, this); }, this);
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
//this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); //this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Gizmo_State] = 1; Attributes[GameAttribute.Gizmo_State] = 1;
this.CollFlags = 0; CollFlags = 0;
this.isOpened = true; isOpened = true;
TickerSystem.TickTimer Timeout = new TickerSystem.SecondsTickTimer(this.World.Game, 1.8f); TickerSystem.TickTimer Timeout = new TickerSystem.SecondsTickTimer(World.Game, 1.8f);
if (NearestPortal != null) if (NearestPortal != null)
{ {
var Boom = System.Threading.Tasks.Task<bool>.Factory.StartNew(() => WaitToSpawn(Timeout)); var Boom = Task<bool>.Factory.StartNew(() => WaitToSpawn(Timeout));
Boom.ContinueWith(delegate Boom.ContinueWith(delegate
{ {
NearestPortal.SetVisible(true); NearestPortal.SetVisible(true);
foreach (var plr in this.World.Players.Values) foreach (var plr in World.Players.Values)
NearestPortal.Unreveal(plr); NearestPortal.Unreveal(plr);
}); });
} }
@ -142,11 +142,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
if (this.Attributes[GameAttribute.Disabled]) return; if (Attributes[GameAttribute.Disabled]) return;
this.Open(); Open();
base.OnTargeted(player, message); base.OnTargeted(player, message);
this.Attributes[GameAttribute.Disabled] = true; Attributes[GameAttribute.Disabled] = true;
} }
private bool WaitToSpawn(TickerSystem.TickTimer timer) private bool WaitToSpawn(TickerSystem.TickTimer timer)

View File

@ -35,11 +35,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
//this.Field2 = 0x9;//16; //this.Field2 = 0x9;//16;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
//this.Attributes[GameAttribute.MinimapIconOverride] = 218394; //this.Attributes[GameAttribute.MinimapIconOverride] = 218394;
if (this.World.SNO.IsDungeon()) if (World.SNO.IsDungeon())
{ {
this.Destination = new ResolvedPortalDestination() Destination = new ResolvedPortalDestination()
{ {
DestLevelAreaSNO = 332339, DestLevelAreaSNO = 332339,
WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub, WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub,
@ -60,29 +60,29 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (actor is Portal) if (actor is Portal)
Exit = actor as Portal; Exit = actor as Portal;
if (Exit != null) if (Exit != null)
this.Destination = Exit.Destination; Destination = Exit.Destination;
} }
else if (Destination == null) else if (Destination == null)
this.Destination = this.World.PrevLocation; Destination = World.PrevLocation;
player.InGameClient.SendMessage(new PortalSpecifierMessage() player.InGameClient.SendMessage(new PortalSpecifierMessage()
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
Destination = this.Destination Destination = Destination
}); });
return true; return true;
} }
public StartingPoint GetSmartStartingPoint(World world) public StartingPoint GetSmartStartingPoint(World world)
{ {
if (this.Destination.StartingPointActorTag != 0) if (Destination.StartingPointActorTag != 0)
{ {
StartingPoint NeededStartingPoint = world.GetStartingPointById(this.Destination.StartingPointActorTag); StartingPoint NeededStartingPoint = world.GetStartingPointById(Destination.StartingPointActorTag);
var DestWorld = world.Game.GetWorld((WorldSno)this.Destination.WorldSNO); var DestWorld = world.Game.GetWorld((WorldSno)Destination.WorldSNO);
var StartingPoints = DestWorld.GetActorsBySNO(ActorSno._start_location_0); var StartingPoints = DestWorld.GetActorsBySNO(ActorSno._start_location_0);
foreach (var ST in StartingPoints) foreach (var ST in StartingPoints)
{ {
if (ST.CurrentScene.SceneSNO.Id == this.Destination.StartingPointActorTag) if (ST.CurrentScene.SceneSNO.Id == Destination.StartingPointActorTag)
NeededStartingPoint = (ST as StartingPoint); NeededStartingPoint = (ST as StartingPoint);
} }
if (NeededStartingPoint != null) if (NeededStartingPoint != null)
@ -97,22 +97,22 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
Logger.Debug("(OnTargeted) Portal has been activated "); Logger.Debug("(OnTargeted) Portal has been activated ");
if (this.World.SNO.IsDungeon()) if (World.SNO.IsDungeon())
{ {
this.Destination.DestLevelAreaSNO = 332339; Destination.DestLevelAreaSNO = 332339;
this.Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub; Destination.WorldSNO = (int)WorldSno.x1_tristram_adventure_mode_hub;
this.Destination.StartingPointActorTag = 24; Destination.StartingPointActorTag = 24;
} }
var world = this.World.Game.GetWorld((WorldSno)this.Destination.WorldSNO); var world = World.Game.GetWorld((WorldSno)Destination.WorldSNO);
if (world == null) if (world == null)
{ {
Logger.Warn("Portal's destination world does not exist (WorldSNO = {0})", this.Destination.WorldSNO); Logger.Warn("Portal's destination world does not exist (WorldSNO = {0})", Destination.WorldSNO);
return; return;
} }
var startingPoint = world.GetStartingPointById(this.Destination.StartingPointActorTag); var startingPoint = world.GetStartingPointById(Destination.StartingPointActorTag);
if (startingPoint == null) if (startingPoint == null)
startingPoint = GetSmartStartingPoint(world); startingPoint = GetSmartStartingPoint(world);
@ -120,9 +120,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (startingPoint != null) if (startingPoint != null)
{ {
player.ShowConfirmation(this.DynamicID(player), (() => { player.ShowConfirmation(DynamicID(player), (() => {
player.StartCasting(150, new Action(() => { player.StartCasting(150, new Action(() => {
if (world == this.World) if (world == World)
player.Teleport(startingPoint.Position); player.Teleport(startingPoint.Position);
else else
player.ChangeWorld(world, startingPoint); player.ChangeWorld(world, startingPoint);
@ -131,7 +131,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
} }
else else
Logger.Warn("Portal's tagged starting point does not exist (Tag = {0})", this.Destination.StartingPointActorTag); Logger.Warn("Portal's tagged starting point does not exist (Tag = {0})", Destination.StartingPointActorTag);
} }
} }
} }

View File

@ -28,7 +28,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public EquipmentManager(MapSystem.World world, ActorSno sno, TagMap tags) public EquipmentManager(MapSystem.World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
} }
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
@ -36,7 +36,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
// player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage23) - Бафф (шрайн) // player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage23) - Бафф (шрайн)
player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage45) player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage45)
{ {
ActorID = this.DynamicID(player) ActorID = DynamicID(player)
}); });
} }
@ -45,7 +45,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Map.MapMarkerInfoMessage() player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Map.MapMarkerInfoMessage()
{ {
HashedName = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("EquipmentManagerTest"), HashedName = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("EquipmentManagerTest"),
Place = new MessageSystem.Message.Fields.WorldPlace { Position = this.Position, WorldID = this.World.GlobalID }, Place = new MessageSystem.Message.Fields.WorldPlace { Position = Position, WorldID = World.GlobalID },
ImageInfo = -1, ImageInfo = -1,
Label = -1, Label = -1,
snoStringList = -1, snoStringList = -1,

View File

@ -24,9 +24,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public Ghost(World world, ActorSno sno, TagMap tags) public Ghost(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.CollFlags = 0; CollFlags = 0;
this.WalkSpeed = 0; WalkSpeed = 0;
this.Attributes[GameAttribute.Invulnerable] = true; Attributes[GameAttribute.Invulnerable] = true;
} }
} }
} }

View File

@ -29,24 +29,24 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
: base(world, sno, tags) : base(world, sno, tags)
{ {
// Override minimap icon in markerset tags // Override minimap icon in markerset tags
this.WalkSpeed = 0; WalkSpeed = 0;
this.Brain = new MonsterBrain(this); Brain = new MonsterBrain(this);
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
//this.Attributes[GameAttribute.MinimapIconOverride] = 123152; //this.Attributes[GameAttribute.MinimapIconOverride] = 123152;
this.Attributes[GameAttribute.Hitpoints_Max] *= 3f; Attributes[GameAttribute.Hitpoints_Max] *= 3f;
this.Attributes[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Max_Total]; Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
//this.Attributes[GameAttribute.Immune_To_Charm] = true; //this.Attributes[GameAttribute.Immune_To_Charm] = true;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] = 0f; Attributes[GameAttribute.Damage_Weapon_Min, 0] = 0f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 0f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 0f;
//(this.Brain as MonsterBrain).AddPresetPower(54055); //TreasureGoblinPause //(this.Brain as MonsterBrain).AddPresetPower(54055); //TreasureGoblinPause
(this.Brain as MonsterBrain).AddPresetPower(105371); //TreasureGoblin_Escape (Brain as MonsterBrain).AddPresetPower(105371); //TreasureGoblin_Escape
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.World.SNO == WorldSno.a1dun_spidercave_01 || this.World.SNO == WorldSno.trout_oldtistram_cellar_3) if (World.SNO == WorldSno.a1dun_spidercave_01 || World.SNO == WorldSno.trout_oldtistram_cellar_3)
{ {
this.Destroy(); Destroy();
return false; return false;
} }

View File

@ -22,10 +22,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.playerIndex = playerIndex; this.playerIndex = playerIndex;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.Attributes[GameAttribute.Headstone_Player_ANN] = 1; Attributes[GameAttribute.Headstone_Player_ANN] = 1;
this.Attributes[GameAttribute.TeamID] = 1; Attributes[GameAttribute.TeamID] = 1;
if (this.World.Game.PvP) this.Attributes[GameAttribute.Disabled] = true; if (World.Game.PvP) Attributes[GameAttribute.Disabled] = true;
} }
@ -39,8 +39,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override void OnTargeted(PlayerSystem.Player player, TargetMessage message) public override void OnTargeted(PlayerSystem.Player player, TargetMessage message)
{ {
base.OnTargeted(player, message); base.OnTargeted(player, message);
if (this.playerIndex > -1) if (playerIndex > -1)
this.GetPlayersInRange(100f).Where(p => p.PlayerIndex == this.playerIndex).First().Resurrect(); GetPlayersInRange(100f).Where(p => p.PlayerIndex == playerIndex).First().Resurrect();
//this.Destroy(); //this.Destroy();
} }
} }

View File

@ -23,8 +23,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public Healer(World world, ActorSno sno, TagMap tags) public Healer(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.TeamID] = 0; Attributes[GameAttribute.TeamID] = 0;
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
} }
public override void OnTargeted(PlayerSystem.Player player, TargetMessage message) public override void OnTargeted(PlayerSystem.Player player, TargetMessage message)

View File

@ -34,9 +34,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
//Logger.Warn("Healthwell has no function, Powers not implemented"); //Logger.Warn("Healthwell has no function, Powers not implemented");
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
//this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); //this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Gizmo_State] = 1; Attributes[GameAttribute.Gizmo_State] = 1;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
player.AddPercentageHP(50); player.AddPercentageHP(50);
player.AddAchievementCounter(74987243307169, 1); player.AddAchievementCounter(74987243307169, 1);
@ -47,7 +47,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Map.MapMarkerInfoMessage() player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Map.MapMarkerInfoMessage()
{ {
HashedName = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("x1_OpenWorld_LootRunObelisk_B"), HashedName = DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("x1_OpenWorld_LootRunObelisk_B"),
Place = new MessageSystem.Message.Fields.WorldPlace { Position = this.Position, WorldID = this.World.GlobalID }, Place = new MessageSystem.Message.Fields.WorldPlace { Position = Position, WorldID = World.GlobalID },
ImageInfo = 218234, ImageInfo = 218234,
Label = -1, Label = -1,
snoStringList = -1, snoStringList = -1,

View File

@ -35,38 +35,38 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public HearthPortal(World world, ActorSno sno, TagMap tags) public HearthPortal(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.MinimapActive] = true; Attributes[GameAttribute.MinimapActive] = true;
this.SetVisible(false); SetVisible(false);
} }
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
Logger.Trace("(OnTargeted) HearthPortal has been activated "); Logger.Trace("(OnTargeted) HearthPortal has been activated ");
var world = this.World.Game.GetWorld(this.ReturnWorld); var world = World.Game.GetWorld(ReturnWorld);
if (world == null) if (world == null)
{ {
Logger.Warn("HearthPortal's world does not exist (WorldSNO = {0})", this.ReturnWorld); Logger.Warn("HearthPortal's world does not exist (WorldSNO = {0})", ReturnWorld);
return; return;
} }
if (this.World.Game.QuestManager.SideQuests.ContainsKey(120396) && this.World.Game.QuestManager.SideQuests[120396].Completed && this.ReturnWorld == WorldSno.a2dun_zolt_timed01_level01) return; if (World.Game.QuestManager.SideQuests.ContainsKey(120396) && World.Game.QuestManager.SideQuests[120396].Completed && ReturnWorld == WorldSno.a2dun_zolt_timed01_level01) return;
Vector3D exCheckpoint = player.CheckPointPosition; Vector3D exCheckpoint = player.CheckPointPosition;
if (world == this.World) if (world == World)
player.Teleport(ReturnPosition); player.Teleport(ReturnPosition);
else else
player.ChangeWorld(world, ReturnPosition); player.ChangeWorld(world, ReturnPosition);
player.CheckPointPosition = exCheckpoint; player.CheckPointPosition = exCheckpoint;
this.SetVisible(false); SetVisible(false);
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (player != this.Owner) return false; if (player != Owner) return false;
return base.Reveal(player); return base.Reveal(player);
} }
} }

View File

@ -53,7 +53,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public HiddenVendor(World world, ActorSno sno, TagMap tags) public HiddenVendor(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Enabled = (FastRandom.Instance.Next(100) < 40); Enabled = (FastRandom.Instance.Next(100) < 40);
} }
protected override List<Item> GetVendorItems() protected override List<Item> GetVendorItems()
@ -62,7 +62,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
{ {
var itm = ItemGenerator.GenerateRandomEquip(this, this.level, 6, 7); var itm = ItemGenerator.GenerateRandomEquip(this, level, 6, 7);
itm.Attributes[GameAttribute.Item_Cost_Percent_Bonus] = 3f; itm.Attributes[GameAttribute.Item_Cost_Percent_Bonus] = 3f;
list.Add(itm); list.Add(itm);
} }
@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override bool Reveal(PlayerSystem.Player player) public override bool Reveal(PlayerSystem.Player player)
{ {
if (!this.Enabled) return false; if (!Enabled) return false;
return base.Reveal(player); return base.Reveal(player);
} }

View File

@ -25,7 +25,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
proxySNO = ActorSno._hireling_enchantress_proxy; proxySNO = ActorSno._hireling_enchantress_proxy;
skillKit = 484938; skillKit = 484938;
hirelingGBID = StringHashHelper.HashItemName("Enchantress"); hirelingGBID = StringHashHelper.HashItemName("Enchantress");
this.Attributes[GameAttribute.Hireling_Class] = 3; Attributes[GameAttribute.Hireling_Class] = 3;
} }
public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags) public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags)
@ -41,9 +41,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 102057: case 102057:
case 101969: case 101969:
player.HirelingInfo[3].Skill1SNOId = SkillSNOId; player.HirelingInfo[3].Skill1SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 102057 ? 101969 : 102057)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 102057 ? 101969 : 102057)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill1SNOId = SkillSNOId; dbhireling.Skill1SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -51,9 +51,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 102133: case 102133:
case 101461: case 101461:
player.HirelingInfo[3].Skill2SNOId = SkillSNOId; player.HirelingInfo[3].Skill2SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 102133 ? 101461 : 102133)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 102133 ? 101461 : 102133)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill2SNOId = SkillSNOId; dbhireling.Skill2SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -61,9 +61,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 101990: case 101990:
case 220872: case 220872:
player.HirelingInfo[3].Skill3SNOId = SkillSNOId; player.HirelingInfo[3].Skill3SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 101990 ? 220872 : 101990)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 101990 ? 220872 : 101990)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill3SNOId = SkillSNOId; dbhireling.Skill3SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -71,9 +71,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 101425: case 101425:
case 201524: case 201524:
player.HirelingInfo[3].Skill4SNOId = SkillSNOId; player.HirelingInfo[3].Skill4SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 101425 ? 201524 : 101425)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 101425 ? 201524 : 101425)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill4SNOId = SkillSNOId; dbhireling.Skill4SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -97,15 +97,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
player.HirelingInfo[3].Skill3SNOId = -1; player.HirelingInfo[3].Skill3SNOId = -1;
player.HirelingInfo[3].Skill4SNOId = -1; player.HirelingInfo[3].Skill4SNOId = -1;
this.Attributes[GameAttribute.Skill, 102057] = 0; Attributes[GameAttribute.Skill, 102057] = 0;
this.Attributes[GameAttribute.Skill, 101969] = 0; Attributes[GameAttribute.Skill, 101969] = 0;
this.Attributes[GameAttribute.Skill, 102133] = 0; Attributes[GameAttribute.Skill, 102133] = 0;
this.Attributes[GameAttribute.Skill, 101461] = 0; Attributes[GameAttribute.Skill, 101461] = 0;
this.Attributes[GameAttribute.Skill, 101990] = 0; Attributes[GameAttribute.Skill, 101990] = 0;
this.Attributes[GameAttribute.Skill, 220872] = 0; Attributes[GameAttribute.Skill, 220872] = 0;
this.Attributes[GameAttribute.Skill, 101425] = 0; Attributes[GameAttribute.Skill, 101425] = 0;
this.Attributes[GameAttribute.Skill, 201524] = 0; Attributes[GameAttribute.Skill, 201524] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
} }

View File

@ -54,33 +54,33 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
public bool IsProxy { get { return SNO == proxySNO; } } public bool IsProxy { get { return SNO == proxySNO; } }
public bool IsHireling { get { return SNO == hirelingSNO; } } public bool IsHireling { get { return SNO == hirelingSNO; } }
public bool HasHireling { get { return this.hirelingSNO != ActorSno.__NONE; } } public bool HasHireling { get { return hirelingSNO != ActorSno.__NONE; } }
public bool HasProxy { get { return this.proxySNO != ActorSno.__NONE; } } public bool HasProxy { get { return proxySNO != ActorSno.__NONE; } }
public int PetType { get { return IsProxy ? 22 : 0; } } public int PetType { get { return IsProxy ? 22 : 0; } }
private Dictionary<Player, Dictionary<int, Item>> _equipment = new Dictionary<Player, Dictionary<int, Item>>(); private Dictionary<Player, Dictionary<int, Item>> _equipment = new Dictionary<Player, Dictionary<int, Item>>();
public Hireling(MapSystem.World world, ActorSno sno, TagMap tags) public Hireling(MapSystem.World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Attributes[GameAttribute.TeamID] = 2; Attributes[GameAttribute.TeamID] = 2;
Interactions.Add(new HireInteraction()); Interactions.Add(new HireInteraction());
Interactions.Add(new InventoryInteraction()); Interactions.Add(new InventoryInteraction());
if (skillKit != -1) if (skillKit != -1)
this.Attributes[GameAttribute.SkillKit] = skillKit; Attributes[GameAttribute.SkillKit] = skillKit;
} }
public void SetUpAttributes(Player player) public void SetUpAttributes(Player player)
{ {
this.owner = player; owner = player;
var info = player.HirelingInfo[this.Attributes[GameAttribute.Hireling_Class]]; var info = player.HirelingInfo[Attributes[GameAttribute.Hireling_Class]];
//* //*
// TODO: fix this hardcoded crap // TODO: fix this hardcoded crap
if (!IsProxy) if (!IsProxy)
this.Attributes[GameAttribute.Buff_Visual_Effect, 0x000FFFFF] = true; Attributes[GameAttribute.Buff_Visual_Effect, 0x000FFFFF] = true;
this.Attributes[GameAttribute.Level] = player.Level; Attributes[GameAttribute.Level] = player.Level;
this.Attributes[GameAttribute.Experience_Next_Lo] = 0; Attributes[GameAttribute.Experience_Next_Lo] = 0;
if (!IsHireling && !IsProxy) // original doesn't need more attribs if (!IsHireling && !IsProxy) // original doesn't need more attribs
return; return;
@ -88,70 +88,70 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
if (info.Skill1SNOId != -1) if (info.Skill1SNOId != -1)
{ {
//scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill1SNOId] = 1; //scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill1SNOId] = 1;
this.Attributes[GameAttribute.Skill, info.Skill1SNOId] = 1; Attributes[GameAttribute.Skill, info.Skill1SNOId] = 1;
} }
if (info.Skill2SNOId != -1) if (info.Skill2SNOId != -1)
{ {
//scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill2SNOId] = 1; //scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill2SNOId] = 1;
this.Attributes[GameAttribute.Skill, info.Skill2SNOId] = 1; Attributes[GameAttribute.Skill, info.Skill2SNOId] = 1;
} }
if (info.Skill3SNOId != -1) if (info.Skill3SNOId != -1)
{ {
//scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill3SNOId] = 1; //scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill3SNOId] = 1;
this.Attributes[GameAttribute.Skill, info.Skill3SNOId] = 1; Attributes[GameAttribute.Skill, info.Skill3SNOId] = 1;
} }
if (info.Skill4SNOId != -1) if (info.Skill4SNOId != -1)
{ {
//scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill4SNOId] = 1; //scripted //this.Attributes[GameAttribute.Skill_Total, info.Skill4SNOId] = 1;
this.Attributes[GameAttribute.Skill, info.Skill4SNOId] = 1; Attributes[GameAttribute.Skill, info.Skill4SNOId] = 1;
} }
/**/ /**/
this._lastResourceUpdateTick = 0; _lastResourceUpdateTick = 0;
this.Attributes[GameAttribute.SkillKit] = skillKit; Attributes[GameAttribute.SkillKit] = skillKit;
this.WalkSpeed = 0.45f; WalkSpeed = 0.45f;
#region hardcoded attribs :/ #region hardcoded attribs :/
//* //*
this.Attributes[GameAttribute.Attacks_Per_Second] = 1f; Attributes[GameAttribute.Attacks_Per_Second] = 1f;
this.Attributes[GameAttribute.Attacks_Per_Second_Item] = 1.199219f; Attributes[GameAttribute.Attacks_Per_Second_Item] = 1.199219f;
this.Attributes[GameAttribute.Casting_Speed] = 1; Attributes[GameAttribute.Casting_Speed] = 1;
this.Attributes[GameAttribute.Damage_Delta, 0] = 1f; Attributes[GameAttribute.Damage_Delta, 0] = 1f;
this.Attributes[GameAttribute.Damage_Min, 0] = 1f; Attributes[GameAttribute.Damage_Min, 0] = 1f;
this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 2f; Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 2f;
this.Attributes[GameAttribute.Damage_Weapon_Min, 0] = 6f; Attributes[GameAttribute.Damage_Weapon_Min, 0] = 6f;
this.Attributes[GameAttribute.General_Cooldown] = 0; Attributes[GameAttribute.General_Cooldown] = 0;
this.Attributes[GameAttribute.Hit_Chance] = 1; Attributes[GameAttribute.Hit_Chance] = 1;
this.Attributes[GameAttribute.Hitpoints_Factor_Vitality] = 10f + Math.Max(this.Attributes[GameAttribute.Level] - 35, 0); Attributes[GameAttribute.Hitpoints_Factor_Vitality] = 10f + Math.Max(Attributes[GameAttribute.Level] - 35, 0);
this.Attributes[GameAttribute.Hitpoints_Max] = 276f; Attributes[GameAttribute.Hitpoints_Max] = 276f;
this.Attributes[GameAttribute.Hitpoints_Cur] = 1f; Attributes[GameAttribute.Hitpoints_Cur] = 1f;
this.Attributes[GameAttribute.Level_Cap] = 70; Attributes[GameAttribute.Level_Cap] = 70;
this.Attributes[GameAttribute.Movement_Scalar] = 1; Attributes[GameAttribute.Movement_Scalar] = 1;
this.Attributes[GameAttribute.Resource_Max, 0] = 1.0f; Attributes[GameAttribute.Resource_Max, 0] = 1.0f;
this.Attributes[GameAttribute.Resource_Cur, 0] = 1.0f; Attributes[GameAttribute.Resource_Cur, 0] = 1.0f;
this.Attributes[GameAttribute.Resource_Type_Primary] = 0; Attributes[GameAttribute.Resource_Type_Primary] = 0;
this.Attributes[GameAttribute.Running_Rate] = 0.3598633f; Attributes[GameAttribute.Running_Rate] = 0.3598633f;
this.Attributes[GameAttribute.Sprinting_Rate] = 0.3598633f; Attributes[GameAttribute.Sprinting_Rate] = 0.3598633f;
this.Attributes[GameAttribute.Strafing_Rate] = 0.1799316f; Attributes[GameAttribute.Strafing_Rate] = 0.1799316f;
this.Attributes[GameAttribute.Walking_Rate] = 0.3598633f; Attributes[GameAttribute.Walking_Rate] = 0.3598633f;
if (IsProxy) if (IsProxy)
return; return;
this.Attributes[GameAttribute.Callout_Cooldown, 0x000FFFFF] = 0x00000797; Attributes[GameAttribute.Callout_Cooldown, 0x000FFFFF] = 0x00000797;
this.Attributes[GameAttribute.Buff_Visual_Effect, 0x000FFFFF] = true; Attributes[GameAttribute.Buff_Visual_Effect, 0x000FFFFF] = true;
this.Attributes[GameAttribute.Buff_Icon_Count0, 0x000075C1] = 1; Attributes[GameAttribute.Buff_Icon_Count0, 0x000075C1] = 1;
this.Attributes[GameAttribute.Buff_Exclusive_Type_Active, 0x000075C1] = true; Attributes[GameAttribute.Buff_Exclusive_Type_Active, 0x000075C1] = true;
this.Attributes[GameAttribute.Conversation_Icon, 0] = 1; Attributes[GameAttribute.Conversation_Icon, 0] = 1;
this.Attributes[GameAttribute.Buff_Exclusive_Type_Active, 0x20c51] = true; Attributes[GameAttribute.Buff_Exclusive_Type_Active, 0x20c51] = true;
this.Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00020C51] = 0x00000A75; Attributes[GameAttribute.Buff_Icon_End_Tick0, 0x00020C51] = 0x00000A75;
this.Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00020C51] = 0x00000375; Attributes[GameAttribute.Buff_Icon_Start_Tick0, 0x00020C51] = 0x00000375;
this.Attributes[GameAttribute.Buff_Icon_Count0, 0x00020C51] = 3; Attributes[GameAttribute.Buff_Icon_Count0, 0x00020C51] = 3;
this.Attributes[GameAttribute.Callout_Cooldown, 0x1618a] = 743; Attributes[GameAttribute.Callout_Cooldown, 0x1618a] = 743;
this.Attributes[GameAttribute.Callout_Cooldown, 0x01CAB6] = 743; Attributes[GameAttribute.Callout_Cooldown, 0x01CAB6] = 743;
//*/ //*/
#endregion #endregion
@ -164,69 +164,69 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
public void UpdateAttributes() public void UpdateAttributes()
{ {
if (!this.IsHireling || this.owner == null) if (!IsHireling || owner == null)
return; return;
//* //*
try try
{ {
this.Attributes[GameAttribute.Vitality] = 5f + (this.Attributes[GameAttribute.Level] * 2) + (this.GetItemBonus(GameAttribute.Vitality_Item));// * 2.5f); Attributes[GameAttribute.Vitality] = 5f + (Attributes[GameAttribute.Level] * 2) + (GetItemBonus(GameAttribute.Vitality_Item));// * 2.5f);
this.Attributes[GameAttribute.Strength] = 5f + (this.Attributes[GameAttribute.Level] * (this is Templar ? 3 : 1)) + (this.GetItemBonus(GameAttribute.Strength_Item));// * 2.5f); Attributes[GameAttribute.Strength] = 5f + (Attributes[GameAttribute.Level] * (this is Templar ? 3 : 1)) + (GetItemBonus(GameAttribute.Strength_Item));// * 2.5f);
this.Attributes[GameAttribute.Dexterity] = 5f + (this.Attributes[GameAttribute.Level] * (this is Scoundrel ? 3 : 1)) + (this.GetItemBonus(GameAttribute.Dexterity_Item));// * 2.5f); Attributes[GameAttribute.Dexterity] = 5f + (Attributes[GameAttribute.Level] * (this is Scoundrel ? 3 : 1)) + (GetItemBonus(GameAttribute.Dexterity_Item));// * 2.5f);
this.Attributes[GameAttribute.Intelligence] = 5f + (this.Attributes[GameAttribute.Level] * (this is Enchantress ? 3 : 1)) + (this.GetItemBonus(GameAttribute.Intelligence_Item));// * 2.5f); Attributes[GameAttribute.Intelligence] = 5f + (Attributes[GameAttribute.Level] * (this is Enchantress ? 3 : 1)) + (GetItemBonus(GameAttribute.Intelligence_Item));// * 2.5f);
this.Attributes[GameAttribute.Attacks_Per_Second_Item] = this.GetItemBonus(GameAttribute.Attacks_Per_Second_Item); Attributes[GameAttribute.Attacks_Per_Second_Item] = GetItemBonus(GameAttribute.Attacks_Per_Second_Item);
//* //*
this.Attributes[GameAttribute.Crit_Percent_Bonus_Capped] = this.GetItemBonus(GameAttribute.Crit_Percent_Bonus_Capped); Attributes[GameAttribute.Crit_Percent_Bonus_Capped] = GetItemBonus(GameAttribute.Crit_Percent_Bonus_Capped);
this.Attributes[GameAttribute.Weapon_Crit_Chance] = this.GetItemBonus(GameAttribute.Weapon_Crit_Chance); Attributes[GameAttribute.Weapon_Crit_Chance] = GetItemBonus(GameAttribute.Weapon_Crit_Chance);
this.Attributes[GameAttribute.Crit_Damage_Percent] = 0.5f + this.GetItemBonus(GameAttribute.Crit_Damage_Percent); Attributes[GameAttribute.Crit_Damage_Percent] = 0.5f + GetItemBonus(GameAttribute.Crit_Damage_Percent);
this.Attributes[GameAttribute.Crit_Percent_Bonus_Uncapped] = this.GetItemBonus(GameAttribute.Crit_Percent_Bonus_Uncapped); Attributes[GameAttribute.Crit_Percent_Bonus_Uncapped] = GetItemBonus(GameAttribute.Crit_Percent_Bonus_Uncapped);
this.Attributes[GameAttribute.Armor_Item] = this.GetItemBonus(GameAttribute.Armor_Item); Attributes[GameAttribute.Armor_Item] = GetItemBonus(GameAttribute.Armor_Item);
//* //*
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
this.Attributes[GameAttribute.Damage_Weapon_Min, i] = Math.Max(this.GetItemBonus(GameAttribute.Damage_Weapon_Min, i), 2f) + this.GetItemBonus(GameAttribute.Damage_Min, i); Attributes[GameAttribute.Damage_Weapon_Min, i] = Math.Max(GetItemBonus(GameAttribute.Damage_Weapon_Min, i), 2f) + GetItemBonus(GameAttribute.Damage_Min, i);
this.Attributes[GameAttribute.Damage_Weapon_Delta, i] = Math.Max(this.GetItemBonus(GameAttribute.Damage_Weapon_Delta_Total, i), 2f) + this.GetItemBonus(GameAttribute.Damage_Delta, i); Attributes[GameAttribute.Damage_Weapon_Delta, i] = Math.Max(GetItemBonus(GameAttribute.Damage_Weapon_Delta_Total, i), 2f) + GetItemBonus(GameAttribute.Damage_Delta, i);
this.Attributes[GameAttribute.Damage_Weapon_Bonus_Min, i] = this.GetItemBonus(GameAttribute.Damage_Weapon_Bonus_Min, i); Attributes[GameAttribute.Damage_Weapon_Bonus_Min, i] = GetItemBonus(GameAttribute.Damage_Weapon_Bonus_Min, i);
this.Attributes[GameAttribute.Damage_Weapon_Bonus_Delta, i] = this.GetItemBonus(GameAttribute.Damage_Weapon_Bonus_Delta, i); Attributes[GameAttribute.Damage_Weapon_Bonus_Delta, i] = GetItemBonus(GameAttribute.Damage_Weapon_Bonus_Delta, i);
this.Attributes[GameAttribute.Resistance, i] = this.GetItemBonus(GameAttribute.Resistance, i); Attributes[GameAttribute.Resistance, i] = GetItemBonus(GameAttribute.Resistance, i);
} }
//*/ //*/
this.Attributes[GameAttribute.Resistance_All] = this.GetItemBonus(GameAttribute.Resistance_All); Attributes[GameAttribute.Resistance_All] = GetItemBonus(GameAttribute.Resistance_All);
this.Attributes[GameAttribute.Resistance_Percent_All] = this.GetItemBonus(GameAttribute.Resistance_Percent_All); Attributes[GameAttribute.Resistance_Percent_All] = GetItemBonus(GameAttribute.Resistance_Percent_All);
this.Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee] = this.GetItemBonus(GameAttribute.Damage_Percent_Reduction_From_Melee); Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee] = GetItemBonus(GameAttribute.Damage_Percent_Reduction_From_Melee);
this.Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged] = this.GetItemBonus(GameAttribute.Damage_Percent_Reduction_From_Ranged); Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged] = GetItemBonus(GameAttribute.Damage_Percent_Reduction_From_Ranged);
this.Attributes[GameAttribute.Thorns_Fixed] = this.GetItemBonus(GameAttribute.Thorns_Fixed, 0); Attributes[GameAttribute.Thorns_Fixed] = GetItemBonus(GameAttribute.Thorns_Fixed, 0);
this.Attributes[GameAttribute.Steal_Health_Percent] = this.GetItemBonus(GameAttribute.Steal_Health_Percent); Attributes[GameAttribute.Steal_Health_Percent] = GetItemBonus(GameAttribute.Steal_Health_Percent);
this.Attributes[GameAttribute.Hitpoints_On_Hit] = this.GetItemBonus(GameAttribute.Hitpoints_On_Hit); Attributes[GameAttribute.Hitpoints_On_Hit] = GetItemBonus(GameAttribute.Hitpoints_On_Hit);
this.Attributes[GameAttribute.Hitpoints_On_Kill] = this.GetItemBonus(GameAttribute.Hitpoints_On_Kill); Attributes[GameAttribute.Hitpoints_On_Kill] = GetItemBonus(GameAttribute.Hitpoints_On_Kill);
this.Attributes[GameAttribute.Magic_Find] = this.GetItemBonus(GameAttribute.Magic_Find); Attributes[GameAttribute.Magic_Find] = GetItemBonus(GameAttribute.Magic_Find);
this.Attributes[GameAttribute.Gold_Find] = this.GetItemBonus(GameAttribute.Gold_Find); Attributes[GameAttribute.Gold_Find] = GetItemBonus(GameAttribute.Gold_Find);
this.Attributes[GameAttribute.Dodge_Chance_Bonus] = this.GetItemBonus(GameAttribute.Dodge_Chance_Bonus); Attributes[GameAttribute.Dodge_Chance_Bonus] = GetItemBonus(GameAttribute.Dodge_Chance_Bonus);
this.Attributes[GameAttribute.Block_Amount_Item_Min] = this.GetItemBonus(GameAttribute.Block_Amount_Item_Min); Attributes[GameAttribute.Block_Amount_Item_Min] = GetItemBonus(GameAttribute.Block_Amount_Item_Min);
this.Attributes[GameAttribute.Block_Amount_Item_Delta] = this.GetItemBonus(GameAttribute.Block_Amount_Item_Delta); Attributes[GameAttribute.Block_Amount_Item_Delta] = GetItemBonus(GameAttribute.Block_Amount_Item_Delta);
this.Attributes[GameAttribute.Block_Amount_Bonus_Percent] = this.GetItemBonus(GameAttribute.Block_Amount_Bonus_Percent); Attributes[GameAttribute.Block_Amount_Bonus_Percent] = GetItemBonus(GameAttribute.Block_Amount_Bonus_Percent);
this.Attributes[GameAttribute.Block_Chance] = this.GetItemBonus(GameAttribute.Block_Chance_Item_Total); Attributes[GameAttribute.Block_Chance] = GetItemBonus(GameAttribute.Block_Chance_Item_Total);
//*/ //*/
this.Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Item] = this.GetItemBonus(GameAttribute.Hitpoints_Max_Percent_Bonus_Item); Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Item] = GetItemBonus(GameAttribute.Hitpoints_Max_Percent_Bonus_Item);
this.Attributes[GameAttribute.Hitpoints_Max_Bonus] = this.GetItemBonus(GameAttribute.Hitpoints_Max_Bonus); Attributes[GameAttribute.Hitpoints_Max_Bonus] = GetItemBonus(GameAttribute.Hitpoints_Max_Bonus);
this.Attributes[GameAttribute.Hitpoints_Factor_Vitality] = 10f + Math.Max(this.Attributes[GameAttribute.Level] - 35, 0); Attributes[GameAttribute.Hitpoints_Factor_Vitality] = 10f + Math.Max(Attributes[GameAttribute.Level] - 35, 0);
this.Attributes[GameAttribute.Hitpoints_Regen_Per_Second] = this.GetItemBonus(GameAttribute.Hitpoints_Regen_Per_Second) + 10f + (10f * this.Attributes[GameAttribute.Level]); Attributes[GameAttribute.Hitpoints_Regen_Per_Second] = GetItemBonus(GameAttribute.Hitpoints_Regen_Per_Second) + 10f + (10f * Attributes[GameAttribute.Level]);
this.Attributes[GameAttribute.Core_Attributes_From_Item_Bonus_Multiplier] = 1; Attributes[GameAttribute.Core_Attributes_From_Item_Bonus_Multiplier] = 1;
this.Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = 1; Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = 1;
this.Attributes[GameAttribute.Hitpoints_Max] = 276f; //+ (this.Attributes[GameAttribute.Vitality] * (10f + Math.Max(this.Attributes[GameAttribute.Level] - 35, 0))); Attributes[GameAttribute.Hitpoints_Max] = 276f; //+ (this.Attributes[GameAttribute.Vitality] * (10f + Math.Max(this.Attributes[GameAttribute.Level] - 35, 0)));
this.Attributes[GameAttribute.Hitpoints_Cur] = this.Attributes[GameAttribute.Hitpoints_Max_Total]; Attributes[GameAttribute.Hitpoints_Cur] = Attributes[GameAttribute.Hitpoints_Max_Total];
/**/ /**/
} }
catch { } catch { }
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
/**/ /**/
} }
@ -235,13 +235,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
if (hirelingSNO == ActorSno.__NONE) if (hirelingSNO == ActorSno.__NONE)
return; return;
if (this.World.Game.Players.Count > 1) return; if (World.Game.Players.Count > 1) return;
if (IsHireling || IsProxy) if (IsHireling || IsProxy)
return; // This really shouldn't happen.. /fasbat return; // This really shouldn't happen.. /fasbat
this.Unreveal(player); Unreveal(player);
var hireling = CreateHireling(this.World, hirelingSNO, this.Tags); var hireling = CreateHireling(World, hirelingSNO, Tags);
hireling.SetUpAttributes(player); hireling.SetUpAttributes(player);
hireling.GBHandle.Type = 4; hireling.GBHandle.Type = 4;
hireling.GBHandle.GBID = hirelingGBID; hireling.GBHandle.GBID = hirelingGBID;
@ -252,11 +252,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
hireling.Attributes[GameAttribute.Untargetable] = false; hireling.Attributes[GameAttribute.Untargetable] = false;
hireling.Attributes[GameAttribute.NPC_Is_Escorting] = true; hireling.Attributes[GameAttribute.NPC_Is_Escorting] = true;
hireling.RotationW = this.RotationW; hireling.RotationW = RotationW;
hireling.RotationAxis = this.RotationAxis; hireling.RotationAxis = RotationAxis;
//hireling.Brain.DeActivate(); //hireling.Brain.DeActivate();
hireling.EnterWorld(this.Position); hireling.EnterWorld(Position);
hireling.Brain = new HirelingBrain(hireling, player); hireling.Brain = new HirelingBrain(hireling, player);
//(hireling.Brain as HirelingBrain).Activate(); //(hireling.Brain as HirelingBrain).Activate();
player.ActiveHireling = hireling; player.ActiveHireling = hireling;
@ -281,10 +281,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
if (IsHireling || IsProxy) if (IsHireling || IsProxy)
return; return;
if (player.ActiveHireling.Attributes[GameAttribute.Hireling_Class] == this.Attributes[GameAttribute.Hireling_Class]) if (player.ActiveHireling.Attributes[GameAttribute.Hireling_Class] == Attributes[GameAttribute.Hireling_Class])
return; return;
var hireling = CreateHireling(this.World, proxySNO, this.Tags); var hireling = CreateHireling(World, proxySNO, Tags);
hireling.SetUpAttributes(player); hireling.SetUpAttributes(player);
hireling.GBHandle.Type = 4; hireling.GBHandle.Type = 4;
hireling.GBHandle.GBID = hirelingGBID; hireling.GBHandle.GBID = hirelingGBID;
@ -297,48 +297,48 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
hireling.Attributes[GameAttribute.Pet_Type] = 1; hireling.Attributes[GameAttribute.Pet_Type] = 1;
hireling.Attributes[GameAttribute.Pet_Owner] = player.PlayerIndex + 1; hireling.Attributes[GameAttribute.Pet_Owner] = player.PlayerIndex + 1;
hireling.RotationW = this.RotationW; hireling.RotationW = RotationW;
hireling.RotationAxis = this.RotationAxis; hireling.RotationAxis = RotationAxis;
hireling.EnterWorld(this.Position); hireling.EnterWorld(Position);
} }
public void Dismiss() public void Dismiss()
{ {
this.Destroy(); Destroy();
} }
public void Update(int tickCounter) public void Update(int tickCounter)
{ {
if (this.Brain == null) if (Brain == null)
return; return;
if (!this.Dead) if (!Dead)
this.Brain.Update(tickCounter); Brain.Update(tickCounter);
if (this.World.Game.TickCounter % 30 == 0 && !this.Dead) if (World.Game.TickCounter % 30 == 0 && !Dead)
{ {
float tickSeconds = 1f / 60f * (this.World.Game.TickCounter - _lastResourceUpdateTick); float tickSeconds = 1f / 60f * (World.Game.TickCounter - _lastResourceUpdateTick);
_lastResourceUpdateTick = this.World.Game.TickCounter; _lastResourceUpdateTick = World.Game.TickCounter;
float quantity = tickSeconds * this.Attributes[GameAttribute.Hitpoints_Regen_Per_Second]; float quantity = tickSeconds * Attributes[GameAttribute.Hitpoints_Regen_Per_Second];
this.AddHP(quantity); AddHP(quantity);
} }
} }
public override void AddHP(float quantity, bool GuidingLight = false) public override void AddHP(float quantity, bool GuidingLight = false)
{ {
if (this.Dead) return; if (Dead) return;
if (quantity == 0) return; if (quantity == 0) return;
if (quantity > 0) if (quantity > 0)
{ {
if (this.Attributes[GameAttribute.Hitpoints_Cur] < this.Attributes[GameAttribute.Hitpoints_Max_Total]) if (Attributes[GameAttribute.Hitpoints_Cur] < Attributes[GameAttribute.Hitpoints_Max_Total])
{ {
this.Attributes[GameAttribute.Hitpoints_Cur] = Math.Min( Attributes[GameAttribute.Hitpoints_Cur] = Math.Min(
this.Attributes[GameAttribute.Hitpoints_Cur] + quantity, Attributes[GameAttribute.Hitpoints_Cur] + quantity,
this.Attributes[GameAttribute.Hitpoints_Max_Total]); Attributes[GameAttribute.Hitpoints_Max_Total]);
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
} }
} }
} }
@ -347,7 +347,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
{ {
return new VisualInventoryMessage() return new VisualInventoryMessage()
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
EquipmentList = new VisualEquipment() EquipmentList = new VisualEquipment()
{ {
Equipment = new VisualItem[] Equipment = new VisualItem[]
@ -415,13 +415,13 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.World.Game.PvP) if (World.Game.PvP)
return false; return false;
if (this.World.Game.Players.Count > 1) if (World.Game.Players.Count > 1)
return false; return false;
if (!IsHireling && ((player.ActiveHireling != null && this.Attributes[GameAttribute.Hireling_Class] == player.ActiveHireling.Attributes[GameAttribute.Hireling_Class])))// || (player.HirelingId != null && this.Attributes[GameAttribute.Hireling_Class] == player.HirelingId))) if (!IsHireling && ((player.ActiveHireling != null && Attributes[GameAttribute.Hireling_Class] == player.ActiveHireling.Attributes[GameAttribute.Hireling_Class])))// || (player.HirelingId != null && this.Attributes[GameAttribute.Hireling_Class] == player.HirelingId)))
return false; return false;
if (owner == null) if (owner == null)
@ -434,21 +434,21 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
if (!_equipment.ContainsKey(player)) if (!_equipment.ContainsKey(player))
{ {
this.LoadInventory(player); LoadInventory(player);
} }
foreach (var item in this._equipment[player].Values) foreach (var item in _equipment[player].Values)
item.Reveal(player); item.Reveal(player);
player.InGameClient.SendMessage(GetVisualEquipment(player)); player.InGameClient.SendMessage(GetVisualEquipment(player));
if (this.IsHireling && owner != null && owner == player) if (IsHireling && owner != null && owner == player)
player.InGameClient.SendMessage(new PetMessage() //70-77 player.InGameClient.SendMessage(new PetMessage() //70-77
{ {
Owner = player.PlayerIndex, Owner = player.PlayerIndex,
Index = 10, Index = 10,
PetId = this.DynamicID(player), PetId = DynamicID(player),
Type = this.SNO == ActorSno._x1_malthael_npc ? 29 : 0, Type = SNO == ActorSno._x1_malthael_npc ? 29 : 0,
}); });
return true; return true;
@ -459,49 +459,49 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
if (!base.Unreveal(player)) if (!base.Unreveal(player))
return false; return false;
foreach (var item in this._equipment[player].Values) foreach (var item in _equipment[player].Values)
item.Unreveal(player); item.Unreveal(player);
return true; return true;
} }
public void LoadInventory(Player player) public void LoadInventory(Player player)
{ {
this._equipment.Add(player, new Dictionary<int, Item>()); _equipment.Add(player, new Dictionary<int, Item>());
var inventory_list = this.World.Game.GameDBSession.SessionQueryWhere<DBInventory>(dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.HirelingId != 0 && dbi.HirelingId == this.Attributes[GameAttribute.Hireling_Class]); var inventory_list = World.Game.GameDBSession.SessionQueryWhere<DBInventory>(dbi => dbi.DBToon.Id == player.Toon.PersistentID && dbi.HirelingId != 0 && dbi.HirelingId == Attributes[GameAttribute.Hireling_Class]);
foreach (var inv_item in inventory_list) foreach (var inv_item in inventory_list)
{ {
Item item = ItemGenerator.LoadFromDB(player, inv_item); Item item = ItemGenerator.LoadFromDB(player, inv_item);
item.Owner = this; item.Owner = this;
item.Attributes[GameAttribute.Item_Equipped] = true; item.Attributes[GameAttribute.Item_Equipped] = true;
item.SetInventoryLocation(inv_item.EquipmentSlot, 0, 0); item.SetInventoryLocation(inv_item.EquipmentSlot, 0, 0);
if (!this._equipment[player].ContainsKey(inv_item.EquipmentSlot)) if (!_equipment[player].ContainsKey(inv_item.EquipmentSlot))
this._equipment[player].Add(inv_item.EquipmentSlot, item); _equipment[player].Add(inv_item.EquipmentSlot, item);
//Logger.Info("Item {0} added to hireling equipment", inv_item.GbId); //Logger.Info("Item {0} added to hireling equipment", inv_item.GbId);
} }
this.UpdateAttributes(); UpdateAttributes();
} }
public void EquipItem(Player owner, int slot, Item item) public void EquipItem(Player owner, int slot, Item item)
{ {
if (item.DBInventory == null) return; if (item.DBInventory == null) return;
if (this._equipment[owner].ContainsKey(slot)) if (_equipment[owner].ContainsKey(slot))
this.UnequipItem(owner, slot, item); UnequipItem(owner, slot, item);
item.Owner = this; item.Owner = this;
item.SetInventoryLocation(slot, 0, 0); item.SetInventoryLocation(slot, 0, 0);
item.DBInventory.HirelingId = this.Attributes[GameAttribute.Hireling_Class]; item.DBInventory.HirelingId = Attributes[GameAttribute.Hireling_Class];
item.DBInventory.EquipmentSlot = slot; item.DBInventory.EquipmentSlot = slot;
item.DBInventory.LocationX = 0; item.DBInventory.LocationX = 0;
item.DBInventory.LocationY = 0; item.DBInventory.LocationY = 0;
this.World.Game.GameDBSession.SessionUpdate(item.DBInventory); World.Game.GameDBSession.SessionUpdate(item.DBInventory);
item.Attributes[GameAttribute.Item_Equipped] = true; item.Attributes[GameAttribute.Item_Equipped] = true;
this._equipment[owner].Add(slot, item); _equipment[owner].Add(slot, item);
this.RefreshEquipment(owner); RefreshEquipment(owner);
this.UpdateAttributes(); UpdateAttributes();
if (this._equipment[owner].Count >= 6) if (_equipment[owner].Count >= 6)
owner.GrantAchievement(74987243307149); owner.GrantAchievement(74987243307149);
} }
@ -509,39 +509,39 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
{ {
if (item.DBInventory == null) return; if (item.DBInventory == null) return;
if (!this._equipment[owner].ContainsKey(slot)) return; if (!_equipment[owner].ContainsKey(slot)) return;
item.Owner = owner; item.Owner = owner;
this._equipment[owner].Remove(slot); _equipment[owner].Remove(slot);
this.World.Game.GameDBSession.SessionDelete(item.DBInventory); World.Game.GameDBSession.SessionDelete(item.DBInventory);
owner.Inventory.PickUp(item); owner.Inventory.PickUp(item);
item.Unreveal(owner); item.Unreveal(owner);
item.Attributes[GameAttribute.Item_Equipped] = false; item.Attributes[GameAttribute.Item_Equipped] = false;
item.Reveal(owner); item.Reveal(owner);
this.RefreshEquipment(owner); RefreshEquipment(owner);
this.UpdateAttributes(); UpdateAttributes();
} }
public void UnequipItemFromSlot(Player owner, int slot) public void UnequipItemFromSlot(Player owner, int slot)
{ {
if (!this._equipment[owner].ContainsKey(slot)) return; if (!_equipment[owner].ContainsKey(slot)) return;
var item = this._equipment[owner][slot]; var item = _equipment[owner][slot];
this.UnequipItem(owner, slot, item); UnequipItem(owner, slot, item);
} }
public Item GetItemByDynId(Player player, uint DynamicId) public Item GetItemByDynId(Player player, uint DynamicId)
{ {
if (this._equipment[player].Values.Where(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId).Count() > 0) if (_equipment[player].Values.Where(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId).Count() > 0)
return this._equipment[player].Values.Single(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId); return _equipment[player].Values.Single(it => it.IsRevealedToPlayer(player) && it.DynamicID(player) == DynamicId);
else else
return null; return null;
} }
public void RefreshEquipment(Player player) public void RefreshEquipment(Player player)
{ {
foreach (var item in this._equipment[player].Values) foreach (var item in _equipment[player].Values)
item.Unreveal(player); item.Unreveal(player);
foreach (var item in this._equipment[player].Values) foreach (var item in _equipment[player].Values)
item.Reveal(player); item.Reveal(player);
player.InGameClient.SendMessage(GetVisualEquipment(player)); player.InGameClient.SendMessage(GetVisualEquipment(player));
@ -551,12 +551,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
public List<Item> GetEquippedItems(Player player) public List<Item> GetEquippedItems(Player player)
{ {
return this._equipment[player].Values.ToList(); return _equipment[player].Values.ToList();
} }
public float GetItemBonus(GameAttributeF attributeF) public float GetItemBonus(GameAttributeF attributeF)
{ {
var stats = this.GetEquippedItems(this.owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0); var stats = GetEquippedItems(owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0);
if (attributeF == GameAttribute.Attacks_Per_Second_Item) if (attributeF == GameAttribute.Attacks_Per_Second_Item)
return stats.Count() > 0 ? stats.Select(item => item.Attributes[attributeF]).Where(a => a > 0f).Aggregate(1f, (x, y) => x * y) : 0f; return stats.Count() > 0 ? stats.Select(item => item.Attributes[attributeF]).Where(a => a > 0f).Aggregate(1f, (x, y) => x * y) : 0f;
@ -566,22 +566,22 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
public int GetItemBonus(GameAttributeI attributeI) public int GetItemBonus(GameAttributeI attributeI)
{ {
return this.GetEquippedItems(this.owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI]); return GetEquippedItems(owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI]);
} }
public bool GetItemBonus(GameAttributeB attributeB) public bool GetItemBonus(GameAttributeB attributeB)
{ {
return this.GetEquippedItems(this.owner).Where(item => item.Attributes[attributeB] == true).Count() > 0; return GetEquippedItems(owner).Where(item => item.Attributes[attributeB] == true).Count() > 0;
} }
public float GetItemBonus(GameAttributeF attributeF, int attributeKey) public float GetItemBonus(GameAttributeF attributeF, int attributeKey)
{ {
return this.GetEquippedItems(this.owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeF, attributeKey]); return GetEquippedItems(owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeF, attributeKey]);
} }
public int GetItemBonus(GameAttributeI attributeI, int attributeKey) public int GetItemBonus(GameAttributeI attributeI, int attributeKey)
{ {
return this.GetEquippedItems(this.owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI, attributeKey]); return GetEquippedItems(owner).Where(item => item.Attributes[GameAttribute.Durability_Cur] > 0 || item.Attributes[GameAttribute.Durability_Max] == 0).Sum(item => item.Attributes[attributeI, attributeKey]);
} }
#endregion #endregion
} }

View File

@ -35,19 +35,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
skillKit = 0x8AFE; skillKit = 0x8AFE;
hirelingGBID = StringHashHelper.HashItemName("Scoundrel"); hirelingGBID = StringHashHelper.HashItemName("Scoundrel");
Attributes[GameAttribute.Hireling_Class] = 4; Attributes[GameAttribute.Hireling_Class] = 4;
var MS = this.Attributes[GameAttribute.Movement_Scalar]; var MS = Attributes[GameAttribute.Movement_Scalar];
var RS = this.Attributes[GameAttribute.Run_Speed_Granted]; var RS = Attributes[GameAttribute.Run_Speed_Granted];
var MSRP = this.Attributes[GameAttribute.Movement_Scalar_Reduction_Percent]; var MSRP = Attributes[GameAttribute.Movement_Scalar_Reduction_Percent];
this.Attributes[GameAttribute.Movement_Scalar] = 3f; Attributes[GameAttribute.Movement_Scalar] = 3f;
this.Attributes[GameAttribute.Run_Speed_Granted] = 3f; Attributes[GameAttribute.Run_Speed_Granted] = 3f;
//this.Attributes[GameAttribute.Movement_Scalar_Reduction_Percent] -= 20f; //this.Attributes[GameAttribute.Movement_Scalar_Reduction_Percent] -= 20f;
this.WalkSpeed = 0.3f; Attributes[GameAttribute.Hitpoints_Max] = 9999f; WalkSpeed = 0.3f; Attributes[GameAttribute.Hitpoints_Max] = 9999f;
var HPM = this.Attributes[GameAttribute.Hitpoints_Max]; var HPM = Attributes[GameAttribute.Hitpoints_Max];
var HPMT = this.Attributes[GameAttribute.Hitpoints_Max_Total]; var HPMT = Attributes[GameAttribute.Hitpoints_Max_Total];
Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = 1; Attributes[GameAttribute.Hitpoints_Max_Percent_Bonus_Multiplicative] = 1;
Attributes[GameAttribute.Hitpoints_Max] = this.Attributes[GameAttribute.Hitpoints_Max_Total]; Attributes[GameAttribute.Hitpoints_Max] = Attributes[GameAttribute.Hitpoints_Max_Total];
} }
@ -63,7 +63,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Inventory.VisualInventoryMessage() player.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Inventory.VisualInventoryMessage()
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
EquipmentList = new MessageSystem.Message.Fields.VisualEquipment() EquipmentList = new MessageSystem.Message.Fields.VisualEquipment()
{ {
Equipment = new MessageSystem.Message.Fields.VisualItem[] Equipment = new MessageSystem.Message.Fields.VisualItem[]

View File

@ -25,9 +25,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
proxySNO = ActorSno._hireling_templar_proxy; proxySNO = ActorSno._hireling_templar_proxy;
skillKit = 484941; skillKit = 484941;
hirelingGBID = StringHashHelper.HashItemName("Templar"); hirelingGBID = StringHashHelper.HashItemName("Templar");
this.Attributes[GameAttribute.Hireling_Class] = 0; Attributes[GameAttribute.Hireling_Class] = 0;
this.Attributes[GameAttribute.TeamID] = 2; Attributes[GameAttribute.TeamID] = 2;
this.Attributes[GameAttribute.Team_Override] = 2; Attributes[GameAttribute.Team_Override] = 2;
} }
public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags) public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags)
@ -43,9 +43,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 102057: case 102057:
case 101969: case 101969:
player.HirelingInfo[3].Skill1SNOId = SkillSNOId; player.HirelingInfo[3].Skill1SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 102057 ? 101969 : 102057)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 102057 ? 101969 : 102057)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill1SNOId = SkillSNOId; dbhireling.Skill1SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -53,9 +53,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 102133: case 102133:
case 101461: case 101461:
player.HirelingInfo[3].Skill2SNOId = SkillSNOId; player.HirelingInfo[3].Skill2SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 102133 ? 101461 : 102133)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 102133 ? 101461 : 102133)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill2SNOId = SkillSNOId; dbhireling.Skill2SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -63,9 +63,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 101990: case 101990:
case 220872: case 220872:
player.HirelingInfo[3].Skill3SNOId = SkillSNOId; player.HirelingInfo[3].Skill3SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 101990 ? 220872 : 101990)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 101990 ? 220872 : 101990)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill3SNOId = SkillSNOId; dbhireling.Skill3SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -73,9 +73,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 101425: case 101425:
case 201524: case 201524:
player.HirelingInfo[3].Skill4SNOId = SkillSNOId; player.HirelingInfo[3].Skill4SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 101425 ? 201524 : 101425)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 101425 ? 201524 : 101425)] = 0;
this.Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
dbhireling.Skill4SNOId = SkillSNOId; dbhireling.Skill4SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -99,15 +99,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
player.HirelingInfo[3].Skill3SNOId = -1; player.HirelingInfo[3].Skill3SNOId = -1;
player.HirelingInfo[3].Skill4SNOId = -1; player.HirelingInfo[3].Skill4SNOId = -1;
this.Attributes[GameAttribute.Skill, 102057] = 0; Attributes[GameAttribute.Skill, 102057] = 0;
this.Attributes[GameAttribute.Skill, 101969] = 0; Attributes[GameAttribute.Skill, 101969] = 0;
this.Attributes[GameAttribute.Skill, 102133] = 0; Attributes[GameAttribute.Skill, 102133] = 0;
this.Attributes[GameAttribute.Skill, 101461] = 0; Attributes[GameAttribute.Skill, 101461] = 0;
this.Attributes[GameAttribute.Skill, 101990] = 0; Attributes[GameAttribute.Skill, 101990] = 0;
this.Attributes[GameAttribute.Skill, 220872] = 0; Attributes[GameAttribute.Skill, 220872] = 0;
this.Attributes[GameAttribute.Skill, 101425] = 0; Attributes[GameAttribute.Skill, 101425] = 0;
this.Attributes[GameAttribute.Skill, 201524] = 0; Attributes[GameAttribute.Skill, 201524] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)

View File

@ -41,9 +41,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 95675: case 95675:
case 30460: case 30460:
player.HirelingInfo[2].Skill1SNOId = SkillSNOId; player.HirelingInfo[2].Skill1SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 95675 ? 30460 : 95675)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 95675 ? 30460 : 95675)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill1SNOId = SkillSNOId; dbhireling.Skill1SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -51,9 +51,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 97436: case 97436:
case 30464: case 30464:
player.HirelingInfo[2].Skill2SNOId = SkillSNOId; player.HirelingInfo[2].Skill2SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 97436 ? 30464 : 97436)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 97436 ? 30464 : 97436)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill2SNOId = SkillSNOId; dbhireling.Skill2SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -61,9 +61,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 95690: case 95690:
case 30458: case 30458:
player.HirelingInfo[2].Skill3SNOId = SkillSNOId; player.HirelingInfo[2].Skill3SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 95690 ? 30458 : 95690)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 95690 ? 30458 : 95690)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill3SNOId = SkillSNOId; dbhireling.Skill3SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -71,9 +71,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 200169: case 200169:
case 30454: case 30454:
player.HirelingInfo[2].Skill4SNOId = SkillSNOId; player.HirelingInfo[2].Skill4SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 200169 ? 30454 : 200169)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 200169 ? 30454 : 200169)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill4SNOId = SkillSNOId; dbhireling.Skill4SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -97,15 +97,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
player.HirelingInfo[2].Skill3SNOId = -1; player.HirelingInfo[2].Skill3SNOId = -1;
player.HirelingInfo[2].Skill4SNOId = -1; player.HirelingInfo[2].Skill4SNOId = -1;
this.Attributes[GameAttribute.Skill, 95675] = 0; Attributes[GameAttribute.Skill, 95675] = 0;
this.Attributes[GameAttribute.Skill, 30460] = 0; Attributes[GameAttribute.Skill, 30460] = 0;
this.Attributes[GameAttribute.Skill, 97436] = 0; Attributes[GameAttribute.Skill, 97436] = 0;
this.Attributes[GameAttribute.Skill, 30464] = 0; Attributes[GameAttribute.Skill, 30464] = 0;
this.Attributes[GameAttribute.Skill, 95690] = 0; Attributes[GameAttribute.Skill, 95690] = 0;
this.Attributes[GameAttribute.Skill, 30458] = 0; Attributes[GameAttribute.Skill, 30458] = 0;
this.Attributes[GameAttribute.Skill, 200169] = 0; Attributes[GameAttribute.Skill, 200169] = 0;
this.Attributes[GameAttribute.Skill, 30454] = 0; Attributes[GameAttribute.Skill, 30454] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
} }

View File

@ -25,7 +25,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
proxySNO = ActorSno._hireling_templar_proxy; proxySNO = ActorSno._hireling_templar_proxy;
skillKit = 484941; skillKit = 484941;
hirelingGBID = StringHashHelper.HashItemName("Templar"); hirelingGBID = StringHashHelper.HashItemName("Templar");
this.Attributes[GameAttribute.Hireling_Class] = 1; Attributes[GameAttribute.Hireling_Class] = 1;
} }
public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags) public override Hireling CreateHireling(MapSystem.World world, ActorSno sno, TagMap tags)
@ -41,9 +41,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 1747: case 1747:
case 93938: case 93938:
player.HirelingInfo[1].Skill1SNOId = SkillSNOId; player.HirelingInfo[1].Skill1SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 1747 ? 93938 : 1747)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 1747 ? 93938 : 1747)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill1SNOId = SkillSNOId; dbhireling.Skill1SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -51,9 +51,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 30357: case 30357:
case 93901: case 93901:
player.HirelingInfo[1].Skill2SNOId = SkillSNOId; player.HirelingInfo[1].Skill2SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 30357 ? 93901 : 30357)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 30357 ? 93901 : 30357)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill2SNOId = SkillSNOId; dbhireling.Skill2SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -61,9 +61,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 30360: case 30360:
case 93888: case 93888:
player.HirelingInfo[1].Skill3SNOId = SkillSNOId; player.HirelingInfo[1].Skill3SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 30360 ? 93888 : 30360)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 30360 ? 93888 : 30360)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill3SNOId = SkillSNOId; dbhireling.Skill3SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -71,9 +71,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
case 30356: case 30356:
case 30359: case 30359:
player.HirelingInfo[1].Skill4SNOId = SkillSNOId; player.HirelingInfo[1].Skill4SNOId = SkillSNOId;
this.Attributes[GameAttribute.Skill, SkillSNOId] = 1; Attributes[GameAttribute.Skill, SkillSNOId] = 1;
this.Attributes[GameAttribute.Skill, (SkillSNOId == 30356 ? 30359 : 30356)] = 0; Attributes[GameAttribute.Skill, (SkillSNOId == 30356 ? 30359 : 30356)] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
dbhireling.Skill4SNOId = SkillSNOId; dbhireling.Skill4SNOId = SkillSNOId;
player.World.Game.GameDBSession.SessionUpdate(dbhireling); player.World.Game.GameDBSession.SessionUpdate(dbhireling);
@ -97,15 +97,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings
player.HirelingInfo[1].Skill3SNOId = -1; player.HirelingInfo[1].Skill3SNOId = -1;
player.HirelingInfo[1].Skill4SNOId = -1; player.HirelingInfo[1].Skill4SNOId = -1;
this.Attributes[GameAttribute.Skill, 1747] = 0; Attributes[GameAttribute.Skill, 1747] = 0;
this.Attributes[GameAttribute.Skill, 93938] = 0; Attributes[GameAttribute.Skill, 93938] = 0;
this.Attributes[GameAttribute.Skill, 30357] = 0; Attributes[GameAttribute.Skill, 30357] = 0;
this.Attributes[GameAttribute.Skill, 93901] = 0; Attributes[GameAttribute.Skill, 93901] = 0;
this.Attributes[GameAttribute.Skill, 30360] = 0; Attributes[GameAttribute.Skill, 30360] = 0;
this.Attributes[GameAttribute.Skill, 93888] = 0; Attributes[GameAttribute.Skill, 93888] = 0;
this.Attributes[GameAttribute.Skill, 30356] = 0; Attributes[GameAttribute.Skill, 30356] = 0;
this.Attributes[GameAttribute.Skill, 30359] = 0; Attributes[GameAttribute.Skill, 30359] = 0;
this.Attributes.SendChangedMessage(player.InGameClient); Attributes.SendChangedMessage(player.InGameClient);
} }

View File

@ -37,7 +37,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{ {
var list = new List<ItemsSystem.Item> var list = new List<ItemsSystem.Item>
{ {
ItemsSystem.ItemGenerator.CookFromDefinition(this.World, ItemsSystem.ItemGenerator.GetItemDefinition(DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("HealthPotionBottomless")), 1, false) //HealthPotionConsole ItemsSystem.ItemGenerator.CookFromDefinition(World, ItemsSystem.ItemGenerator.GetItemDefinition(DiIiS_NA.Core.Helpers.Hash.StringHashHelper.HashItemName("HealthPotionBottomless")), 1, false) //HealthPotionConsole
}; };
return list; return list;

View File

@ -43,12 +43,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
protected override List<ItemsSystem.Item> GetVendorItems() protected override List<ItemsSystem.Item> GetVendorItems()
{ {
return itemGbIds.Select(x => ItemsSystem.ItemGenerator.CookFromDefinition(this.World, ItemsSystem.ItemGenerator.GetItemDefinition(x), 1, false)).ToList(); return itemGbIds.Select(x => ItemsSystem.ItemGenerator.CookFromDefinition(World, ItemsSystem.ItemGenerator.GetItemDefinition(x), 1, false)).ToList();
} }
public override bool Reveal(PlayerSystem.Player player) public override bool Reveal(PlayerSystem.Player player)
{ {
if (this.World.Game.CurrentAct != 3000) return false; if (World.Game.CurrentAct != 3000) return false;
return base.Reveal(player); return base.Reveal(player);
} }

View File

@ -40,22 +40,22 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public LegendaryChest(World world, ActorSno sno, TagMap tags) public LegendaryChest(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.NameSNO = ActorSno._caout_stingingwinds_chest; NameSNO = ActorSno._caout_stingingwinds_chest;
this.Field7 = 1; Field7 = 1;
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (!this.ChestActive) return false; if (!ChestActive) return false;
return base.Reveal(player); return base.Reveal(player);
} }
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
if (this.Attributes[GameAttribute.Disabled]) return; if (Attributes[GameAttribute.Disabled]) return;
int chance = this.World.Game.IsHardcore ? 99 : 25; //S4 special int chance = World.Game.IsHardcore ? 99 : 25; //S4 special
/* /*
if (!player.Inventory.HasItem(-110888638) || (!this.World.Game.IsHardcore && !player.Inventory.HasGold(250000))) if (!player.Inventory.HasItem(-110888638) || (!this.World.Game.IsHardcore && !player.Inventory.HasGold(250000)))
{ {
@ -68,16 +68,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
//player.InGameClient.SendMessage(new BroadcastTextMessage() { Field0 = string.Format("Legendary Chest has been opened. 1 Chain Key {0}consumed.", (this.World.Game.IsHardcore ? "" : "and 250k gold ")) }); //player.InGameClient.SendMessage(new BroadcastTextMessage() { Field0 = string.Format("Legendary Chest has been opened. 1 Chain Key {0}consumed.", (this.World.Game.IsHardcore ? "" : "and 250k gold ")) });
player.Inventory.GetBag().GrabSomeItems(-110888638, 1); player.Inventory.GetBag().GrabSomeItems(-110888638, 1);
if (!this.World.Game.IsHardcore) if (!World.Game.IsHardcore)
player.Inventory.RemoveGoldAmount(250000); player.Inventory.RemoveGoldAmount(250000);
if (FastRandom.Instance.Next(100) < chance) if (FastRandom.Instance.Next(100) < chance)
this.World.SpawnRandomEquip(player, player, LootManager.Epic, player.Level); World.SpawnRandomEquip(player, player, LootManager.Epic, player.Level);
else else
this.World.SpawnRandomEquip(player, player, LootManager.Rare, player.Level); World.SpawnRandomEquip(player, player, LootManager.Rare, player.Level);
var toon = player.Toon.DBToon; var toon = player.Toon.DBToon;
toon.ChestsOpened++; toon.ChestsOpened++;
this.World.Game.GameDBSession.SessionUpdate(toon); World.Game.GameDBSession.SessionUpdate(toon);
} }
base.OnTargeted(player, message); base.OnTargeted(player, message);

View File

@ -38,19 +38,19 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public LootContainer(World world, ActorSno sno, TagMap tags) public LootContainer(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
if (this.SNO == ActorSno._a3dunrmpt_interactives_signal_fire_a_prop) this.Attributes[GameAttribute.MinimapActive] = true; if (SNO == ActorSno._a3dunrmpt_interactives_signal_fire_a_prop) Attributes[GameAttribute.MinimapActive] = true;
if (this.SNO.IsChest() || this.SNO.IsCorpse()) haveDrop = true; if (SNO.IsChest() || SNO.IsCorpse()) haveDrop = true;
switch (sno) switch (sno)
{ {
case ActorSno._trout_highlands_chest_bloody: //bloody case ActorSno._trout_highlands_chest_bloody: //bloody
this.Quality = 1; Quality = 1;
break; break;
case ActorSno._trout_fields_chest_rare: //rare case ActorSno._trout_fields_chest_rare: //rare
case ActorSno._a2dun_zolt_chest_rare: //Zolt_rare case ActorSno._a2dun_zolt_chest_rare: //Zolt_rare
case ActorSno._x1_global_chest_startsclean: //event case ActorSno._x1_global_chest_startsclean: //event
this.Quality = 2; Quality = 2;
break; break;
} }
@ -59,18 +59,18 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.SNO == ActorSno._a2dun_aqd_chest_special_facepuzzle_large && this.World.SNO != WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //dakab chest if (SNO == ActorSno._a2dun_aqd_chest_special_facepuzzle_large && World.SNO != WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //dakab chest
if (this.SNO == ActorSno._a2dun_aqd_chest_rare_facepuzzlesmall && this.World.SNO == WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //not dakab chest if (SNO == ActorSno._a2dun_aqd_chest_rare_facepuzzlesmall && World.SNO == WorldSno.a2dun_aqd_oasis_randomfacepuzzle_large) return false; //not dakab chest
if (!rewardChestAvailable) return false; //event reward chest if (!rewardChestAvailable) return false; //event reward chest
if (!base.Reveal(player)) if (!base.Reveal(player))
return false; return false;
if (this.Attributes[GameAttribute.Disabled]) if (Attributes[GameAttribute.Disabled])
{ {
player.InGameClient.SendMessage(new SetIdleAnimationMessage player.InGameClient.SendMessage(new SetIdleAnimationMessage
{ {
ActorID = this.DynamicID(player), ActorID = DynamicID(player),
AnimationSNO = AnimationSetKeys.Open.ID AnimationSNO = AnimationSetKeys.Open.ID
}); });
} }
@ -81,10 +81,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
if (this.SNO == ActorSno._p4_setdung_totem_cru_thorns) if (SNO == ActorSno._p4_setdung_totem_cru_thorns)
return; return;
if (this.Attributes[GameAttribute.Disabled]) return; if (Attributes[GameAttribute.Disabled]) return;
base.OnTargeted(player, message); base.OnTargeted(player, message);
@ -93,56 +93,56 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (ActorData.TagMap.ContainsKey(ActorKeys.Lore)) if (ActorData.TagMap.ContainsKey(ActorKeys.Lore))
Logger.Debug("Lore detected: {0}", ActorData.TagMap[ActorKeys.Lore].Id); Logger.Debug("Lore detected: {0}", ActorData.TagMap[ActorKeys.Lore].Id);
if (this.SNO == ActorSno._trout_highlands_manor_firewood) //Leor bone if (SNO == ActorSno._trout_highlands_manor_firewood) //Leor bone
{ {
foreach (var plr in this.GetPlayersInRange(30)) foreach (var plr in GetPlayersInRange(30))
this.World.SpawnItem(this, plr, -629520052); World.SpawnItem(this, plr, -629520052);
} }
if (this.SNO == ActorSno._trout_newtristram_adria_blackmushroom) //Black Mushroom if (SNO == ActorSno._trout_newtristram_adria_blackmushroom) //Black Mushroom
{ {
foreach (var plr in this.GetPlayersInRange(30)) foreach (var plr in GetPlayersInRange(30))
this.World.SpawnItem(this, plr, -1993550104); World.SpawnItem(this, plr, -1993550104);
} }
if (this.SNO == ActorSno._caout_oasis_chest_rare_mapvendorcave) //Rainbow Chest if (SNO == ActorSno._caout_oasis_chest_rare_mapvendorcave) //Rainbow Chest
{ {
foreach (var plr in this.GetPlayersInRange(30)) foreach (var plr in GetPlayersInRange(30))
this.World.SpawnItem(this, plr, 725082635); World.SpawnItem(this, plr, 725082635);
} }
if (haveDrop) if (haveDrop)
{ {
var dropRates = this.World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)this.Quality, Program.MaxLevel) : LootManager.GetDropRates((int)this.Quality, Program.MaxLevel); var dropRates = World.Game.IsHardcore ? LootManager.GetSeasonalDropRates((int)Quality, Program.MaxLevel) : LootManager.GetDropRates((int)Quality, Program.MaxLevel);
foreach (var rate in dropRates) foreach (var rate in dropRates)
foreach (var plr in this.GetPlayersInRange(30)) foreach (var plr in GetPlayersInRange(30))
{ {
float seed = (float)FastRandom.Instance.NextDouble(); float seed = (float)FastRandom.Instance.NextDouble();
if (seed < 0.8f) if (seed < 0.8f)
this.World.SpawnGold(this, plr); World.SpawnGold(this, plr);
if (seed < 0.6f) if (seed < 0.6f)
this.World.SpawnGold(this, plr); World.SpawnGold(this, plr);
if (seed < 0.5f) if (seed < 0.5f)
this.World.SpawnRandomCraftItem(this, plr); World.SpawnRandomCraftItem(this, plr);
if (seed < 0.2f) if (seed < 0.2f)
this.World.SpawnRandomCraftItem(this, plr); World.SpawnRandomCraftItem(this, plr);
if (seed < 0.07f) if (seed < 0.07f)
this.World.SpawnRandomGem(this, plr); World.SpawnRandomGem(this, plr);
if (seed < 0.04f) if (seed < 0.04f)
this.World.SpawnRandomGem(this, plr); World.SpawnRandomGem(this, plr);
if (seed < 0.10f) if (seed < 0.10f)
this.World.SpawnRandomPotion(this, plr); World.SpawnRandomPotion(this, plr);
if (seed < (rate * (1f + plr.Attributes[GameAttribute.Magic_Find]))) if (seed < (rate * (1f + plr.Attributes[GameAttribute.Magic_Find])))
{ {
var lootQuality = this.World.Game.IsHardcore ? LootManager.GetSeasonalLootQuality((int)this.Quality, this.World.Game.Difficulty) : LootManager.GetLootQuality((int)this.Quality, this.World.Game.Difficulty); var lootQuality = World.Game.IsHardcore ? LootManager.GetSeasonalLootQuality((int)Quality, World.Game.Difficulty) : LootManager.GetLootQuality((int)Quality, World.Game.Difficulty);
this.World.SpawnRandomEquip(plr, plr, lootQuality); World.SpawnRandomEquip(plr, plr, lootQuality);
} }
else else
break; break;
} }
} }
if (GeneratorsSystem.LoreRegistry.Lore.ContainsKey(this.World.SNO) && GeneratorsSystem.LoreRegistry.Lore[this.World.SNO].chests_lore.ContainsKey(this.SNO)) if (GeneratorsSystem.LoreRegistry.Lore.ContainsKey(World.SNO) && GeneratorsSystem.LoreRegistry.Lore[World.SNO].chests_lore.ContainsKey(SNO))
foreach (var p in this.GetPlayersInRange(30)) foreach (var p in GetPlayersInRange(30))
foreach (int loreId in GeneratorsSystem.LoreRegistry.Lore[this.World.SNO].chests_lore[this.SNO]) foreach (int loreId in GeneratorsSystem.LoreRegistry.Lore[World.SNO].chests_lore[SNO])
if (!p.HasLore(loreId)) if (!p.HasLore(loreId))
{ {
World.DropItem(this, null, ItemGenerator.CreateLore(p, loreId)); World.DropItem(this, null, ItemGenerator.CreateLore(p, loreId));
@ -151,7 +151,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
World.BroadcastIfRevealed(plr => new PlayAnimationMessage World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimReason = 5, AnimReason = 5,
UnitAniimStartTime = 0, UnitAniimStartTime = 0,
tAnim = new PlayAnimationMessageSpec[] tAnim = new PlayAnimationMessageSpec[]
@ -170,28 +170,28 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
World.BroadcastIfRevealed(plr => new SetIdleAnimationMessage World.BroadcastIfRevealed(plr => new SetIdleAnimationMessage
{ {
ActorID = this.DynamicID(plr), ActorID = DynamicID(plr),
AnimationSNO = AnimationSetKeys.Open.ID AnimationSNO = AnimationSetKeys.Open.ID
}, this); }, this);
this.Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true; Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
//this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID); //this.Attributes[GameAttribute.Gizmo_Operator_ACDID] = unchecked((int)player.DynamicID);
this.Attributes[GameAttribute.Chest_Open, 0xFFFFFF] = true; Attributes[GameAttribute.Chest_Open, 0xFFFFFF] = true;
Attributes.BroadcastChangedIfRevealed(); Attributes.BroadcastChangedIfRevealed();
this.Attributes[GameAttribute.Disabled] = true; Attributes[GameAttribute.Disabled] = true;
if (this.SNO == ActorSno._trdun_cath_chandelier_trap_switch2) if (SNO == ActorSno._trdun_cath_chandelier_trap_switch2)
{ {
var lamp = this.GetActorsInRange(50f).Where(x => x.SNO == ActorSno._trdun_cath_chandelier_trap || x.SNO == ActorSno._trdun_cath_braizer_trap).First(); var lamp = GetActorsInRange(50f).Where(x => x.SNO == ActorSno._trdun_cath_chandelier_trap || x.SNO == ActorSno._trdun_cath_braizer_trap).First();
if (lamp != null) if (lamp != null)
(lamp as CathedralLamp).Die(); (lamp as CathedralLamp).Die();
} }
if (this.SNO == ActorSno._a2dun_zolt_centerpiece_a) if (SNO == ActorSno._a2dun_zolt_centerpiece_a)
{ {
if (this.World.SNO == WorldSno.a2dun_zolt_level01) if (World.SNO == WorldSno.a2dun_zolt_level01)
foreach (var plr in this.World.Game.Players.Values) foreach (var plr in World.Game.Players.Values)
plr.InGameClient.SendMessage(new QuestCounterMessage() plr.InGameClient.SendMessage(new QuestCounterMessage()
{ {
snoQuest = 57337, snoQuest = 57337,
@ -202,7 +202,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Checked = 1, Checked = 1,
}); });
else else
foreach (var plr in this.World.Game.Players.Values) foreach (var plr in World.Game.Players.Values)
plr.InGameClient.SendMessage(new QuestCounterMessage() plr.InGameClient.SendMessage(new QuestCounterMessage()
{ {
snoQuest = 57337, snoQuest = 57337,

View File

@ -41,7 +41,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public LootRunPortal(World world, ActorSno sno, TagMap tags) public LootRunPortal(World world, ActorSno sno, TagMap tags)
: base(world, sno, tags) : base(world, sno, tags)
{ {
this.Destination = new ResolvedPortalDestination Destination = new ResolvedPortalDestination
{ {
WorldSNO = (int)WorldSno.x1_westm_graveyard_deathorb, WorldSNO = (int)WorldSno.x1_westm_graveyard_deathorb,
DestLevelAreaSNO = 338946, DestLevelAreaSNO = 338946,
@ -58,7 +58,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
MinimapIcon = ActorData.TagMap[ActorKeys.MinimapMarker].Id; MinimapIcon = ActorData.TagMap[ActorKeys.MinimapMarker].Id;
} }
this.Field2 = 0x9;//16; Field2 = 0x9;//16;
} }
public override bool Reveal(Player player) public override bool Reveal(Player player)
@ -79,43 +79,43 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
public override void OnTargeted(Player player, TargetMessage message) public override void OnTargeted(Player player, TargetMessage message)
{ {
Logger.Debug("(OnTargeted) Portal has been activated, Id: {0}, LevelArea: {1}, World: {2}", (int)this.SNO, this.Destination.DestLevelAreaSNO, this.Destination.WorldSNO); Logger.Debug("(OnTargeted) Portal has been activated, Id: {0}, LevelArea: {1}, World: {2}", (int)SNO, Destination.DestLevelAreaSNO, Destination.WorldSNO);
var world = this.World.Game.GetWorld((WorldSno)this.Destination.WorldSNO); var world = World.Game.GetWorld((WorldSno)Destination.WorldSNO);
if (world == null) if (world == null)
{ {
Logger.Warn("Portal's destination world does not exist (WorldSNO = {0})", this.Destination.WorldSNO); Logger.Warn("Portal's destination world does not exist (WorldSNO = {0})", Destination.WorldSNO);
return; return;
} }
var startingPoint = world.GetStartingPointById(this.Destination.StartingPointActorTag); var startingPoint = world.GetStartingPointById(Destination.StartingPointActorTag);
if (startingPoint != null) if (startingPoint != null)
{ {
if (this.SNO == ActorSno._a2dun_zolt_portal_timedevent) //a2 timed event if (SNO == ActorSno._a2dun_zolt_portal_timedevent) //a2 timed event
{ {
if (!this.World.Game.QuestManager.SideQuests[120396].Completed) if (!World.Game.QuestManager.SideQuests[120396].Completed)
player.ShowConfirmation(this.DynamicID(player), (() => { player.ShowConfirmation(DynamicID(player), (() => {
player.ChangeWorld(world, startingPoint); player.ChangeWorld(world, startingPoint);
})); }));
} }
else else
{ {
if (world == this.World) if (world == World)
player.Teleport(startingPoint.Position); player.Teleport(startingPoint.Position);
else else
player.ChangeWorld(world, startingPoint); player.ChangeWorld(world, startingPoint);
} }
if (this.World.Game.QuestProgress.QuestTriggers.ContainsKey(this.Destination.DestLevelAreaSNO)) //EnterLevelArea if (World.Game.QuestProgress.QuestTriggers.ContainsKey(Destination.DestLevelAreaSNO)) //EnterLevelArea
{ {
var trigger = this.World.Game.QuestProgress.QuestTriggers[this.Destination.DestLevelAreaSNO]; var trigger = World.Game.QuestProgress.QuestTriggers[Destination.DestLevelAreaSNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
{ {
try try
{ {
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
catch (Exception e) catch (Exception e)
{ {
@ -123,14 +123,14 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
} }
} }
} }
if (this.World.Game.SideQuestProgress.QuestTriggers.ContainsKey(this.Destination.DestLevelAreaSNO)) //EnterLevelArea if (World.Game.SideQuestProgress.QuestTriggers.ContainsKey(Destination.DestLevelAreaSNO)) //EnterLevelArea
{ {
var trigger = this.World.Game.SideQuestProgress.QuestTriggers[this.Destination.DestLevelAreaSNO]; var trigger = World.Game.SideQuestProgress.QuestTriggers[Destination.DestLevelAreaSNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
{ {
try try
{ {
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
} }
catch (Exception e) catch (Exception e)
{ {
@ -138,15 +138,15 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
} }
} }
} }
if (this.World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(this.Destination.DestLevelAreaSNO)) //EnterLevelArea if (World.Game.SideQuestProgress.GlobalQuestTriggers.ContainsKey(Destination.DestLevelAreaSNO)) //EnterLevelArea
{ {
var trigger = this.World.Game.SideQuestProgress.GlobalQuestTriggers[this.Destination.DestLevelAreaSNO]; var trigger = World.Game.SideQuestProgress.GlobalQuestTriggers[Destination.DestLevelAreaSNO];
if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea) if (trigger.triggerType == DiIiS_NA.Core.MPQ.FileFormats.QuestStepObjectiveType.EnterLevelArea)
{ {
try try
{ {
trigger.questEvent.Execute(this.World); // launch a questEvent trigger.questEvent.Execute(World); // launch a questEvent
this.World.Game.SideQuestProgress.GlobalQuestTriggers.Remove(this.Destination.DestLevelAreaSNO); World.Game.SideQuestProgress.GlobalQuestTriggers.Remove(Destination.DestLevelAreaSNO);
} }
catch (Exception e) catch (Exception e)
{ {
@ -154,11 +154,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
} }
} }
} }
foreach (var bounty in this.World.Game.QuestManager.Bounties) foreach (var bounty in World.Game.QuestManager.Bounties)
bounty.CheckLevelArea(this.Destination.DestLevelAreaSNO); bounty.CheckLevelArea(Destination.DestLevelAreaSNO);
} }
else else
Logger.Warn("Portal's tagged starting point does not exist (Tag = {0})", this.Destination.StartingPointActorTag); Logger.Warn("Portal's tagged starting point does not exist (Tag = {0})", Destination.StartingPointActorTag);
} }
} }
} }

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(11); DamageCoefficient = context.ScriptFormula(11);
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant (Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant
(Brain as MinionBrain).AddPresetPower(187092); //basic melee (Brain as MinionBrain).AddPresetPower(187092); //basic melee
(Brain as MinionBrain).AddPresetPower(168823); //cleave (Brain as MinionBrain).AddPresetPower(168823); //cleave
@ -44,12 +44,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
Attributes[GameAttribute.Pet_Type] = 0x8; Attributes[GameAttribute.Pet_Type] = 0x8;
//Pet_Owner and Pet_Creator seems to be 0 //Pet_Owner and Pet_Creator seems to be 0
if (this.Master != null) if (Master != null)
{ {
if (this.Master is Player) if (Master is Player)
{ {
if ((this.Master as Player).Followers.Values.Count(a => a == SNO) > 1) if ((Master as Player).Followers.Values.Count(a => a == SNO) > 1)
(this.Master as Player).DestroyFollower(SNO); (Master as Player).DestroyFollower(SNO);
} }
} }

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(11); DamageCoefficient = context.ScriptFormula(11);
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant (Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant
(Brain as MinionBrain).AddPresetPower(187092); //basic melee (Brain as MinionBrain).AddPresetPower(187092); //basic melee
(Brain as MinionBrain).AddPresetPower(168827); //Seismic Slam //Only Active with Rune_C (Brain as MinionBrain).AddPresetPower(168827); //Seismic Slam //Only Active with Rune_C
@ -44,12 +44,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
Attributes[GameAttribute.Pet_Type] = 0x8; Attributes[GameAttribute.Pet_Type] = 0x8;
//Pet_Owner and Pet_Creator seems to be 0 //Pet_Owner and Pet_Creator seems to be 0
if (this.Master != null) if (Master != null)
{ {
if (this.Master is Player) if (Master is Player)
{ {
if ((this.Master as Player).Followers.Values.Count(a => a == SNO) > 1) if ((Master as Player).Followers.Values.Count(a => a == SNO) > 1)
(this.Master as Player).DestroyFollower(SNO); (Master as Player).DestroyFollower(SNO);
} }
} }

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(11); DamageCoefficient = context.ScriptFormula(11);
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant (Brain as MinionBrain).AddPresetPower(30592); //Weapon_Instant
(Brain as MinionBrain).AddPresetPower(187092); //basic melee (Brain as MinionBrain).AddPresetPower(187092); //basic melee
(Brain as MinionBrain).AddPresetPower(168825); //Leap //Only Active with Rune_E (Brain as MinionBrain).AddPresetPower(168825); //Leap //Only Active with Rune_E
@ -44,12 +44,12 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
Attributes[GameAttribute.Pet_Type] = 0x8; Attributes[GameAttribute.Pet_Type] = 0x8;
//Pet_Owner and Pet_Creator seems to be 0 //Pet_Owner and Pet_Creator seems to be 0
if (this.Master != null) if (Master != null)
{ {
if (this.Master is Player) if (Master is Player)
{ {
if ((this.Master as Player).Followers.Values.Count(a => a == SNO) > 1) if ((Master as Player).Followers.Values.Count(a => a == SNO) > 1)
(this.Master as Player).DestroyFollower(SNO); (Master as Player).DestroyFollower(SNO);
} }
} }

View File

@ -41,11 +41,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
if (context.User.Attributes[GameAttribute.Rune_B, 0x000592ff] > 0) Scale = 2f; //Boar if (context.User.Attributes[GameAttribute.Rune_B, 0x000592ff] > 0) Scale = 2f; //Boar
if (context.User.Attributes[GameAttribute.Rune_C, 0x000592ff] > 0) Scale = 2f; //Wolf if (context.User.Attributes[GameAttribute.Rune_C, 0x000592ff] > 0) Scale = 2f; //Wolf
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(0); DamageCoefficient = context.ScriptFormula(0);
this.Attributes[GameAttribute.Invulnerable] = true; Attributes[GameAttribute.Invulnerable] = true;
this.Attributes[GameAttribute.Is_Helper] = true; Attributes[GameAttribute.Is_Helper] = true;
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
if (CompanionSNO == ActorSno._dh_companion_ferret) if (CompanionSNO == ActorSno._dh_companion_ferret)
SetBrain(new LooterBrain(this, false)); SetBrain(new LooterBrain(this, false));
else else

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 0.7f; //they look cooler bigger :) Scale = 0.7f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(16) * 2f; DamageCoefficient = context.ScriptFormula(16) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(30592); //melee_instant (Brain as MinionBrain).AddPresetPower(30592); //melee_instant
//(Brain as MinionBrain).AddPresetPower(30005); //AINearby //(Brain as MinionBrain).AddPresetPower(30005); //AINearby
if (context.Rune_C > 0) if (context.Rune_C > 0)

View File

@ -29,10 +29,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 0.7f; //they look cooler bigger :) Scale = 0.7f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(16) * 2f; DamageCoefficient = context.ScriptFormula(16) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(30592); //melee_instant (Brain as MinionBrain).AddPresetPower(30592); //melee_instant
//(Brain as MinionBrain).AddPresetPower(30005); //AINearby //(Brain as MinionBrain).AddPresetPower(30005); //AINearby
if (context.Rune_C > 0) if (context.Rune_C > 0)
@ -49,16 +49,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
Attributes[GameAttribute.Pet_Type] = 0x8; Attributes[GameAttribute.Pet_Type] = 0x8;
//Pet_Owner and Pet_Creator seems to be 0 //Pet_Owner and Pet_Creator seems to be 0
if (this.Master != null) if (Master != null)
{ {
if (this.Master is Player) if (Master is Player)
{ {
var rem = new List<uint>(); var rem = new List<uint>();
foreach (var fol in (this.Master as Player).Followers) foreach (var fol in (Master as Player).Followers)
if (fol.Value == SNO && fol.Key != this.GlobalID) if (fol.Value == SNO && fol.Key != GlobalID)
rem.Add(fol.Key); rem.Add(fol.Key);
foreach (var rm in rem) foreach (var rm in rem)
(this.Master as Player).DestroyFollowerById(rm); (Master as Player).DestroyFollowerById(rm);
} }
} }

View File

@ -26,10 +26,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(14) * 2f; DamageCoefficient = context.ScriptFormula(14) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(119166); //fetisharmy_hunter.pow (Brain as MinionBrain).AddPresetPower(119166); //fetisharmy_hunter.pow
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
//Attributes[GameAttribute.Hitpoints_Max] = 20f; //Attributes[GameAttribute.Hitpoints_Max] = 20f;

View File

@ -26,10 +26,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(22) * 2f; DamageCoefficient = context.ScriptFormula(22) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
//Attributes[GameAttribute.Hitpoints_Max] = 20f; //Attributes[GameAttribute.Hitpoints_Max] = 20f;
//Attributes[GameAttribute.Hitpoints_Cur] = 20f; //Attributes[GameAttribute.Hitpoints_Cur] = 20f;

View File

@ -26,10 +26,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.2f; //they look cooler bigger :) Scale = 1.2f; //they look cooler bigger :)
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(11) * 2f; DamageCoefficient = context.ScriptFormula(11) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(118442); //fetisharmy_shaman.pow (Brain as MinionBrain).AddPresetPower(118442); //fetisharmy_shaman.pow
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
//Attributes[GameAttribute.Hitpoints_Max] = 20f; //Attributes[GameAttribute.Hitpoints_Max] = 20f;

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1f; Scale = 1f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.DamageCoefficient = context.ScriptFormula(24) * 2f; DamageCoefficient = context.ScriptFormula(24) * 2f;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
//(Brain as MinionBrain).AddPresetPower(30005); //(Brain as MinionBrain).AddPresetPower(30005);
//(Brain as MinionBrain).AddPresetPower(30001); //(Brain as MinionBrain).AddPresetPower(30001);
(Brain as MinionBrain).AddPresetPower(30592); (Brain as MinionBrain).AddPresetPower(30592);
@ -53,16 +53,16 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
Attributes[GameAttribute.Pet_Type] = 0x8; Attributes[GameAttribute.Pet_Type] = 0x8;
//Pet_Owner and Pet_Creator seems to be 0 //Pet_Owner and Pet_Creator seems to be 0
if (this.Master != null) if (Master != null)
{ {
if (this.Master is Player) if (Master is Player)
{ {
var rem = new List<uint>(); var rem = new List<uint>();
foreach (var fol in (this.Master as Player).Followers) foreach (var fol in (Master as Player).Followers)
if (fol.Value == SNO && fol.Key != this.GlobalID) if (fol.Value == SNO && fol.Key != GlobalID)
rem.Add(fol.Key); rem.Add(fol.Key);
foreach (var rm in rem) foreach (var rm in rem)
(this.Master as Player).DestroyFollowerById(rm); (Master as Player).DestroyFollowerById(rm);
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];
@ -59,7 +59,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];
@ -79,7 +79,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];
@ -99,7 +99,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];
@ -118,7 +118,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];
@ -138,7 +138,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1.35f; Scale = 1.35f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 3; WalkSpeed *= 3;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
//TODO: These values should most likely scale, but we don't know how yet, so just temporary values. //TODO: These values should most likely scale, but we don't know how yet, so just temporary values.
Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max]; Attributes[GameAttribute.Hitpoints_Max] = 3000f * (master as Player).Attributes[GameAttribute.Hitpoints_Max];

View File

@ -25,10 +25,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
{ {
Scale = 1f; Scale = 1f;
//TODO: get a proper value for this. //TODO: get a proper value for this.
this.WalkSpeed *= 5; WalkSpeed *= 5;
SetBrain(new MinionBrain(this)); SetBrain(new MinionBrain(this));
this.DamageCoefficient = 1f * 2f; DamageCoefficient = 1f * 2f;
this.Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO; Attributes[GameAttribute.Summoned_By_SNO] = context.PowerSNO;
(Brain as MinionBrain).AddPresetPower(196974); //chicken_walk.pow (Brain as MinionBrain).AddPresetPower(196974); //chicken_walk.pow
(Brain as MinionBrain).AddPresetPower(188442); //explode.pow (Brain as MinionBrain).AddPresetPower(188442); //explode.pow
(Brain as MinionBrain).AddPresetPower(107301); //Fetish.pow (Brain as MinionBrain).AddPresetPower(107301); //Fetish.pow

View File

@ -26,11 +26,11 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
: base(world, ActorSno._fallenlunatic_a, master, null) : base(world, ActorSno._fallenlunatic_a, master, null)
{ {
Scale = 0.75f; Scale = 0.75f;
this.WalkSpeed *= 5; WalkSpeed *= 5;
this.CollFlags = 0; CollFlags = 0;
this.DamageCoefficient = 0; DamageCoefficient = 0;
this.Attributes[GameAttribute.Invulnerable] = true; Attributes[GameAttribute.Invulnerable] = true;
this.Attributes[GameAttribute.Is_Helper] = true; Attributes[GameAttribute.Is_Helper] = true;
SetBrain(new LooterBrain(this, true)); SetBrain(new LooterBrain(this, true));
Attributes[GameAttribute.Attacks_Per_Second] = 1.0f; Attributes[GameAttribute.Attacks_Per_Second] = 1.0f;
@ -40,7 +40,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Minions
public override bool Reveal(Player player) public override bool Reveal(Player player)
{ {
if (this.World.IsPvP) if (World.IsPvP)
return false; return false;
return base.Reveal(player); return base.Reveal(player);
} }

Some files were not shown because too many files have changed in this diff Show More