Neiro il y a 6 ans
Parent
commit
5a877d2686

+ 3 - 0
.vs/ProjectSettings.json

@@ -0,0 +1,3 @@
+{
+  "CurrentProjectSetting": null
+}

+ 6 - 0
.vs/VSWorkspaceState.json

@@ -0,0 +1,6 @@
+{
+  "ExpandedNodes": [
+    ""
+  ],
+  "PreviewInSolutionExplorer": false
+}

BIN
.vs/rotom_bot/v15/.suo


BIN
.vs/slnx.sqlite


BIN
OpenSans-SemiBold.ttf


+ 0 - 89
app/models/image_merger.rb

@@ -11,7 +11,6 @@ end
 def merge_image(image_array, image_out, output_width, output_height, xaxis, yaxis, image_width, image_height)
   i = Magick::ImageList.new(*image_array)
 
-  binding.pry
   v = Magick::ImageList.new
   arr = Array.new(0)
 
@@ -34,92 +33,4 @@ def merge_image(image_array, image_out, output_width, output_height, xaxis, yaxi
   i = Magick::ImageList.new(*arr)
   i = i.flatten_images();
   i.write(image_out + ".png")
-end
-
-def merge_image_slow(image_array, image_out, output_width, output_height, xaxis = nil, yaxis = nil, image_width = nil, image_height = nil)
-  i = Magick::ImageList.new(*image_array)
-  u = Magick::ImageList.new(*image_out)
-  v = Magick::ImageList.new
-
-  if(i.count > 1)
-    if output_width && output_height
-      i.each.with_index do |item, index|
-
-        if !(xaxis && yaxis)
-          i[index] = item.resize(output_width, output_height)
-          i[0] = i[0].composite(i[index], output_width, output_height, OverCompositeOp)
-        end
-        
-        if index == 0
-          u = i[0].write(*image_out);
-        else
-          if xaxis && yaxis          
-            v.new_image(output_width, output_height) { self.background_color = "transparent" }
-
-            if image_width && image_height
-              i[index] = i[index].resize(image_width, image_height)
-            end
-            v = v.composite(i[index], xaxis, yaxis, OverCompositeOp).write(*image_out);
-            u = u.composite(v, xaxis, yaxis, OverCompositeOp).write(*image_out);
-          else
-            u = u.composite(i[index], CenterGravity, OverCompositeOp).write(*image_out)
-          end
-        end
-      end
-    else
-      #No output_width, output_height
-    end
-  else
-    i[0] = i[0].resize(image_width, image_height)
-
-    v.new_image(output_width, output_height) { self.background_color = "transparent" }
-    v = v.composite(i[0], xaxis, yaxis, OverCompositeOp).write(*image_out);
-  end
-end
-
-def crop_image()
-  images = ['images/Type Bug.png', 'images/Type Dark.png', 'images/Type Dark - Copy.png']
-
-  img = Magick::Image.read(images[0]).first # path of Orignal image that has to be worked upon
-  puts img.inspect
-
-  def try(x,y,width,height)
-    images = ['images/Type Bug.png', 'images/Type Dark.png', 'images/Type Dark - Copy.png']
-
-    # converting x,y , width and height to integer values in next four statements
-    x= x.to_i
-    y= y.to_i
-    width= width.to_i
-    height= height.to_i
-
-    # Demonstrate the Image#crop method
-    @st = images[0] # path of image written after changing size or not changing also
-    img = Magick::Image.read(@st)[0]
-
-    # Crop the specified rectangle out of the img.
-    chopped = img.crop(x, y, width,height)
-
-    # Go back to the original and highlight the area
-    # corresponding to the retained rectangle.
-    rect = Magick::Draw.new
-    rect.stroke('transparent')
-    rect.fill('black')
-    rect.fill_opacity(1.0)
-    rect.rectangle(x, y, 100+x, 10+y)
-    rect.draw(img)
-
-    img.write(images[1]) #path of image written before cropping
-
-    # Create a image to use as a background for
-    # the “after” image.
-    bg = Magick::Image.new(img.columns, img.rows)
-
-    # Composite the the “after” (chopped) image on the background
-    bg = bg.composite(chopped, 38,81, Magick::OverCompositeOp)
-
-    bg.write(images[2]) # path of image written after cropping the desired part
-    exit
-  end
-
-  try(100, 50, 150, 100)
 end

+ 84 - 109
bot.rb

@@ -125,107 +125,6 @@ matchup = Command.new(:matchup, desc, opts) do |event, primary, secondary|
   end
 end
 
-opts = { "" => ""}
-desc = "Shows the weather"
-weather = Command.new(:weather, desc, opts) do |event|
-
-  channel = event.channel.id
-  size_width = 700;
-  size_height = 600;
-  output_file =  "images/Image_Builder/Weather"
-  map1 = "images/TheMap1.png"
-  map2 = "images/TheMap2.png"
-  map3 = "images/TheMap3.png"
-  frame = "images/FrameFG.png"
-
-  time = Time.now
-  #Map 1
-  merge_image(
-    ["images/Image_Builder/BG.png", map1, frame, "images/Castform.png",
-    "images/Day_Night.png", "images/Day_Sunny.png","images/Day_Snow.png", "images/Day_Stormy.png",
-    "images/Day_Windy.png","images/Day_Sandstorm.png","images/Day_Rainy.png"],
-    output_file,
-    size_width,
-    size_height,
-    [nil,         size_width-500,  nil, 0,   350, 400, 200, 300, 475, 550, 325],
-    [nil,         size_height-500, nil, 100, 250, 400, 400, 350, 475, 250, 100],
-    [size_width,  500,             nil, 250, 100, 100, 100, 100, 100, 100, 100],
-    [size_height, 500,             nil, 250, 100, 100, 100, 100, 100, 100, 100]
-  )
-
-  temp = ["56°F \ 13°C", "84°F \ 28°C", "61°F \ 16°C", "40°F \ 4°C", "51°F \ 10°C", "59°F \ 15°C", "56°F \ 13°C"]
-  weather = ["Clear", "Partly Cloudy", "Mostly Cloudy", "Rain Shower", "Clear ", "Partly Cloudy", "Cloudy"]
-
-  fullforcast = "Zaplana weather is as follows!\n\n" +
-  "Well, let's start us off at Diglett Cave and Infant Isle. Conditions there are **#{weather[0]}** at a tempature of **#{temp[0]}**.\n\n" +
-  "Moving east by the Ravenous Ruins, Taurel, and Bambina, conditions there look **#{weather[1]}** hanging around a temp of **#{temp[1]}**.\n\n" +
-  "Over in Melody Springs, Liquamond, it's looking **#{weather[2]}** with a tempature of **#{temp[2]}**.\n\n" +
-  "Wrapping right on around the island, the mountain peaks of Styx, Mesmer, and Evo are looking **#{weather[3]}** at **#{temp[3]}**\n\n" +
-  "Anyone looking to visit Moomoo Fields or Lake Carbonation might run into some **#{weather[4]}** conditions around **#{temp[4]}**\n\n" +
-  "In the city, LaRousse and the island are **#{weather[5]}** lingering around **#{temp[5]}**.\n\n" +
-  "And to wrap us up, here in The Village and Obe City is **#{weather[6]}** reaching **#{temp[6]}**.\n\n" +
-  "";
-
-  msg = bot.send_file(channel, File.open("#{output_file}.png", 'r'))
-  event.send_embed("", message_embed("Weather Report", fullforcast, 'https://i.imgur.com/3i9UuHH.png'))
-
-  sleep 1
-
-  #Map 2
-  merge_image(
-    ["images/Image_Builder/BG.png", map2, frame,
-    "images/Castform.png", "images/Day_Night.png", "images/Day_Sunny.png"],
-    output_file,
-    size_width,
-    size_height,
-    [nil,         size_width-500,  nil, 0,   350, 250],
-    [nil,         size_height-500, nil, 100, 400, 100],
-    [size_width,  500,             nil, 250, 100, 100],
-    [size_height, 500,             nil, 250, 100, 100]
-  )
-
-  temp = ["84°F \ 28°C", "85°F \ 29°C"]
-  weather = ["Partly Cloudy", "Fair"]
-
-  fullforcast = "As we move our focus to the West!\n\n" +
-  "We see the conditions at Twin Lakes Island are **#{weather[0]}** at a tempature of **#{temp[0]}**.\n\n" +
-  "The weather over by the Living Islands look **#{weather[1]}** hanging around a temp of **#{temp[1]}**.\n\n" +
-  "";
-
-  msg = bot.send_file(channel, File.open("#{output_file}.png", 'r'))
-  event.send_embed("", message_embed("Weather Report", fullforcast, 'https://i.imgur.com/3i9UuHH.png'))
-
-  sleep 1
-
-  #Map 3
-  merge_image(
-    ["images/Image_Builder/BG.png", map3, frame,
-    "images/Castform.png", "images/Day_Night.png", "images/Day_Sunny.png","images/Day_Snow.png",
-    "images/Day_Stormy.png"],
-    output_file,
-    size_width,
-    size_height,
-    [nil,         size_width-500,  nil, 0,   500, 500, 400, 600],
-    [nil,         size_height-500, nil, 100, 200, 400, 450, 500],
-    [size_width,  500,             nil, 250, 100, 100, 100, 100],
-    [size_height, 500,             nil, 250, 100, 100, 100, 100]
-  )
-
-  temp = ["61°F \ 16°C", "82°F \ 27°C", "57°F \ 13°C", "14°F \ -10°C"]
-  weather =  ["Rain", "Sandstorm", "Clear", "Fair"]
-
-  fullforcast = "Lastly! The lands further east! \n\n" +
-  "Santorini looks **#{weather[0]}** at a tempature of **#{temp[0]}**.\n\n" +
-  "As we travel into the desert, conditions appear **#{weather[1]}** hanging around a temp of **#{temp[1]}**.\n\n" +
-  "On the east coast of Santorini we have conditions looking **#{weather[2]}** with a tempature of **#{temp[2]}**.\n\n" +
-  "And to wrap it up, Glacius seems to be having condiions looking **#{weather[3]}** at **#{temp[3]}**\n\n" +
-  "Back to you in the studio!";
-
-  msg = bot.send_file(channel, File.open("#{output_file}.png", 'r'))
-  event.send_embed("", message_embed("Weather Report", fullforcast, 'https://i.imgur.com/3i9UuHH.png'))
-
-end
-
 opts = {
   "@user" => "List all user stats",
 }
@@ -233,8 +132,8 @@ desc = "Shows ones stats, level, rank, and experience"
 stats = Command.new(:stats, desc, opts) do |event, name|
 
   case name
-  when Regex::UID
-    user_id = Regex::UID.match(name)
+  when UID
+    user_id = UID.match(name)
     user = event.server.member(user_id[1])
     user_url = user.avatar_url if user
   when String
@@ -242,29 +141,100 @@ stats = Command.new(:stats, desc, opts) do |event, name|
   end
 
   channel = event.channel.id
-  size_width = 513;
+  size_width = 570;
   size_height = 376;
   stats_frame =  "images/LevelUp.png"
   level_up = "images/LevelUpFont.png"
-  user_url_img = "images/Image_Builder/user_url.png"
+  user_url_img = "images/Image_Builder/user_url_img.png"
   output_file =  "images/Image_Builder/LevelUp"
 
   Down.download(user_url, destination: user_url_img)
 
+  #Gif Destroyer
   i = Magick::ImageList.new(user_url_img)
   binding.pry
 
+  if(i.count > 1)
+    i[0].write(user_url_img);
+  end
+  #End Gif Destroyer
+
   merge_image(
     [stats_frame, level_up, user_url_img],
     output_file,
     size_width,
     size_height,
-    [nil, 0, 19],
-    [nil, 0, 92],
-    [size_width, 100, 165],
-    [size_width, 100, 165]
+    [nil, nil, 19],
+    [nil, nil, 92],
+    [size_width, size_width, 165],
+    [size_height, size_height, 165]
   )
 
+  # C# code for getting the percantage to the next level
+    #int levelprior = LevelUp[task].NextLevel - (10 * (LevelUp[task].CurrentLevel - 1) ^ 2);
+    #double ratio = (double)(LevelUp[task].Messages - levelprior) / (double)(LevelUp[task].NextLevel - levelprior);
+
+  ratio = 0.5
+
+  gc = Draw.new
+
+  gc.font('OpenSans-SemiBold.ttf')
+
+  gc.stroke('#39c4ff').fill('#39c4ff')
+  gc.rectangle(42, 48, 42 + (95 * ratio), 48 + 3)
+
+  gc.stroke('none').fill('black')
+  gc.pointsize('15')
+  name_sm = "Test Name 1"
+  gc.text(15,25, name_sm)
+  level = 'Lv.4'
+  gc.text(40, 45, level)
+  level_rank = 'Rank 104'
+  gc.text(15, 290, level_rank)
+  exp = '12340'
+  gc.text(40, 65, exp)
+
+  gc.stroke('white').fill('white')
+  gc.pointsize('30')
+  name_lg = "Test Name 2"
+  gc.text(40,330, name_lg)
+  reached = "reached level 4!"
+  gc.text(40,360, reached)
+
+  gc.stroke('none').fill('black')
+  gc.pointsize('18')
+  lvl_max_hp = '10'
+  gc.text(450, 97, lvl_max_hp)
+  lvl_atk = '11'
+  gc.text(450, 127, lvl_atk)
+  lvl_def = '12'
+  gc.text(450, 159, lvl_def)
+  lvl_sp_atk = '13'
+  gc.text(450, 191, lvl_sp_atk)
+  lvl_sp_def = '14'
+  gc.text(450, 222, lvl_sp_def)
+  lvl_speed = '15'
+  gc.text(450, 255, lvl_speed)
+
+  gc.stroke('none').fill('maroon')
+  iv_max_hp = '+10'
+  gc.text(505, 97, iv_max_hp)
+  iv_atk = '+11'
+  gc.text(505, 127, iv_atk)
+  iv_def = '+12'
+  gc.text(505, 159, iv_def)
+  iv_sp_atk = '+13'
+  gc.text(505, 191, iv_sp_atk)
+  iv_sp_def = '+14'
+  gc.text(505, 222, iv_sp_def)
+  iv_speed = '+15'
+  gc.text(505, 255, iv_speed)
+
+  u = Magick::ImageList.new("#{output_file}.png")
+  gc.draw(u[0])
+
+  u.write("#{output_file}.png")
+
   msg = bot.send_file(channel, File.open("#{output_file}.png", 'r'))
 
 end
@@ -781,10 +751,15 @@ commands = [
   member,
   item,
   inv,
+<<<<<<< 77a766d541086a3ee08efe0eebbbcad8820c7865
   status,
   afflict,
   cure,
   team,
+||||||| merged common ancestors
+  weather,
+=======
+>>>>>>> level up
   stats
 ]
 

BIN
images/Image_Builder/LevelUp.png


BIN
images/Image_Builder/Weather.png


BIN
images/Image_Builder/user_url.png


BIN
images/LevelUp.png


BIN
images/LevelUpFont.png