Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Celeste.Library.CoreObjects
- {
- public class WoWLogin
- {
- private WoWCore Core;
- public WoWLogin(WoWCore Core)
- {
- this.Core = Core;
- }
- public bool RealmFrameVisible { get { return Core.Lua.GetReturnVal<bool>("RealmList:IsShown()", 0); } }
- public bool CharSelectVisible { get { return Core.Lua.GetReturnVal<bool>("CharacterSelectUI:IsShown()", 0); } }
- public void Login(string account, string password)
- {
- Core.Lua.DoString(string.Format("DefaultServerLogin('{0}', '{1}');", account, password));
- }
- public void SelectGameAccount(string account)
- {
- Core.Lua.DoString(
- string.Format(
- "for i = 0, GetNumGameAccounts(), 1 do local name = GetGameAccountInfo(i); " +
- "if (name == '{0}') then SetGameAccount(i); end end",
- account));
- }
- public void SelectRealm(string realm)
- {
- if (RealmFrameVisible)
- {
- Core.Lua.DoString(
- string.Format(
- "for i = 1, select('#', GetRealmCategories()), 1 do local numRealms = GetNumRealms(i);" +
- "for j = 1, numRealms, 1 do local name, numCharacters = GetRealmInfo(i, j);" +
- "if (name ~= nil and name == '{0}') ChangeRealm(i,j); end end end",
- realm));
- }
- }
- public void SelectCharacter(string character)
- {
- if (CharSelectVisible)
- {
- Core.Lua.DoString(
- string.Format(
- "for i=0,GetNumCharacters(),1 do local name = GetCharacterInfo(i);" +
- "if (name ~= nil and name == '{0}') then CharacterSelect_SelectCharacter(i); end end",
- character));
- }
- }
- public void EnterWorld()
- {
- Core.Lua.DoString("EnterWorld();");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement