Plus Emu Rev 2, Wired User Says Keyword, slight improvement.
Just to be kind I decided to release a small part of the garbage I've coded.
What is improved?
Well, when adding this the "User says keyword" works pretty much like the one of Habbo. Ignores Lower/Uppercase letter differences. You are able to use space in the keyword. And it gets detected if the keyword is within a sentence.
Example:
Keyword is: Easter bunny
Works: easter bunny, EaStEr BuNnY, etc. And 1gsdsd23Easter bunny1gwsdasf23 also works.
Replace SaysKeyword.cs with this:
PHP Code:
using Silverwave.HabboHotel.Items;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Silverwave.HabboHotel.Rooms.Wired.Handlers.Triggers
{
public class SaysKeyword : WiredItem
{
#region Fields
private WiredItemType mType = WiredItemType.TriggerUserSaysKeyword;
private Room mRoom;
private RoomItem mItem;
private string mKeyword;
private bool mOwner;
#endregion
#region Properties
public WiredItemType Type
{
get { return mType; }
}
public RoomItem Item
{
get { return mItem; }
set { mItem = value; }
}
public Room Room
{
get { return mRoom; }
}
public List<RoomItem> Items
{
get { return new List<RoomItem>(); }
set { }
}
public int Delay
{
get { return 0; }
set { }
}
public string OtherString
{
get { return mKeyword; }
set { mKeyword = value; }
}
public bool OtherBool
{
get { return true; }
set { }
}
public string ItemsList
{
get { return ""; }
set { }
}
#endregion
#region Constructors
public SaysKeyword(RoomItem Item, Room Room)
{
this.mItem = Item;
this.mRoom = Room;
this.mKeyword = "";
this.mOwner = false;
}
#endregion
#region Methods
public bool Execute(params object[] Stuff)
{
RoomUser User = (RoomUser)Stuff[0];
string Message = (string)Stuff[1];
bool Correct = false;
if (string.IsNullOrEmpty(mKeyword))
{
return false;
}
foreach (string Word in Message.Split(' '))
{
if (Message.ToLower().Contains(mKeyword.ToLower()))
{
Correct = true;
}
}
if (!Correct)
{
return false;
}
List<WiredItem> Conditions = mRoom.GetWiredHandler().GetConditions(this);
List<WiredItem> Effects = mRoom.GetWiredHandler().GetEffects(this);
if (Conditions.Count > 0)
{
foreach (WiredItem Condition in Conditions)
{
if (!Condition.Execute(User))
{
return false;
}
mRoom.GetWiredHandler().OnEvent(Condition);
}
}
if (Effects.Count > 0)
{
foreach (WiredItem Effect in Effects)
{
if (!Effect.Execute(User, mType))
{
continue;
}
mRoom.GetWiredHandler().OnEvent(Effect);
}
}
User.GetClient().SendWhisper(Message);
//Room.GetWiredHandler().OnEvent(this);
return true;
}
#endregion
}
}
Re: Plus Emu Rev 2, Wired User Says Keyword, slight improvement.
I did that and it still didn't work, unless i did something wrong >_>
Re: Plus Emu Rev 2, Wired User Says Keyword, slight improvement.
Re: Plus Emu Rev 2, Wired User Says Keyword, slight improvement.
Heres a better version
PHP Code:
using HabboEmulator.HabboHotel.Items;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HabboEmulator.HabboHotel.Rooms.Wired.Handlers.Triggers
{
public class SaysKeyword : WiredItem
{
public WiredSaveType SaveType
{
get { return WiredSaveType.TextBool; }
}
#region Fields
private WiredItemType mType = WiredItemType.TriggerUserSaysKeyword;
private Room mRoom;
private RoomItem mItem;
private string mKeyword;
private bool mOwner;
#endregion
#region Properties
public WiredItemType Type
{
get { return mType; }
}
public RoomItem Item
{
get { return mItem; }
set { mItem = value; }
}
public Room Room
{
get { return mRoom; }
}
public List<RoomItem> Items
{
get { return new List<RoomItem>(); }
set { }
}
public int Delay
{
get { return 0; }
set { }
}
public string OtherString
{
get { return mKeyword; }
set { mKeyword = value; }
}
public bool OtherBool
{
get { return mOwner; }
set { mOwner = value; }
}
#endregion
#region Constructors
public SaysKeyword(RoomItem Item, Room Room)
{
this.mItem = Item;
this.mRoom = Room;
this.mKeyword = "";
this.mOwner = false;
}
#endregion
#region Methods
public bool Execute(params object[] Stuff)
{
RoomUser User = (RoomUser)Stuff[0];
string Message = (string)Stuff[1];
bool Correct = false;
if (string.IsNullOrEmpty(mKeyword))
{
return false;
}
if (Message.ToLower().Contains(mKeyword.ToLower()))
{
List<WiredItem> Conditions = mRoom.GetWiredHandler().GetConditions(this);
List<WiredItem> Effects = mRoom.GetWiredHandler().GetEffects(this);
bool cancontinue = true;
if (Conditions.Count > 0)
{
foreach (WiredItem Condition in Conditions)
{
mRoom.GetWiredHandler().OnEvent(Condition);
if (!Condition.Execute(User))
{
cancontinue = false;
}
}
}
if (Effects.Count > 0 && cancontinue)
{
foreach (WiredItem Effect in Effects)
{
if (!Effect.Execute(User, Type))
{
continue;
}
mRoom.GetWiredHandler().OnEvent(Effect);
}
}
Room.GetWiredHandler().OnEvent(this);
return true;
}
return false;
}
#endregion
}
}
Just change HabboEmulator to Silverwave or w.e
Re: Plus Emu Rev 2, Wired User Says Keyword, slight improvement.
Why did you make a new thread for this?