Thread: EPGP Battle Bot
View Single Post
02-12-17, 11:11 PM   #2
n00bsteam
A Murloc Raider
Join Date: Feb 2017
Posts: 8
Ok, mb someone ca help whit code?

I have this:

Code:
local item = table.remove(queue, 1);
        local rule = item['rule']
        local reason, value, currency, player = battle_bot_get_rule_as_string(rule), rule['value'], rule['currency'], item['player']
        
        if( currency == 'GP' ) then
            if( EPGP:CanIncGPBy(reason, value) ) then
                EPGP:IncGPBy( player, reason, value )
            else
                print("Unabe to charge GP", player, reason, value) -- debugging
            end
        else
            if( EPGP:CanIncEPBy(reason, value) ) then
                EPGP:IncEPBy( player, reason, value )
            else
                print("Unabe to charge EP", player, reason, value) -- debugging
            end
        end
here "player" have only playerName, but it doesnt work, seems to be there playerName-RealmName

I have this code from EPGP Addone:

Code:
local ourRealmName = string.gsub(GetRealmName(), "%s+", "")     -- Realm name with no spaces
function EPGP:GetFullCharacterName(name)
	if string.find(name, "%-") then
		return name;
	else
		return name .. "-" .. ourRealmName;
	end
end
i try to make like this:

Code:
        local item = table.remove(queue, 1);
        local rule = item['rule']
		local ourRealmName = string.gsub(GetRealmName(), "%s+", "")
        local reason, value, currency, player = battle_bot_get_rule_as_string(rule), rule['value'], rule['currency'], item['player']
        
        if( currency == 'GP' ) then
			if string.find(player, "%-") then
		        fullname = player;
	        else
		        fullname = player .. "-" .. ourRealmName
	        end
	    else
            if( EPGP:CanIncGPBy(reason, value) ) then
                EPGP:IncGPBy( fullname, reason, value )
            else
                print("Unabe to charge GP", fullname, reason, value) -- debugging
            end
        else
            if( EPGP:CanIncEPBy(reason, value) ) then
                EPGP:IncEPBy( fullname, reason, value )
            else
                print("Unabe to charge EP", fullname, reason, value) -- debugging
            end
        end
But it doesnt work. What is wrong?
  Reply With Quote