mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 15:30:58 -04:00
Cleanup FindReference and rename it to the more logical ImagePalette class.
This commit is contained in:
parent
4f4cc71f27
commit
9cb3d00939
@ -43,7 +43,7 @@ namespace MCGalaxy.Commands
|
||||
|
||||
bool mapOnly = cmd == "SPAWN" || cmd == "PRESET" || cmd == "WEATHER" || cmd == "ENV" ||
|
||||
cmd == "KICK" || cmd == "KICKALL" || cmd == "ZONE" || cmd == "LB" || cmd == "LEVELBLOCK";
|
||||
if (mapOnly && !p.level.name.ToUpper().StartsWith(p.name.ToUpper())) {
|
||||
if (mapOnly && !p.level.name.CaselessStarts(p.name)) {
|
||||
Player.SendMessage(p, "You may only perform that action on your own map.");
|
||||
return;
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace MCGalaxy.Commands
|
||||
void HandleMapCommand(Player p, string message, string cmd, string value) {
|
||||
bool mapOnly = cmd == "PHYSICS" || cmd == "MOTD" || cmd == "GUNS" ||
|
||||
cmd == "PERVISIT" || cmd == "TEXTURE";
|
||||
if (mapOnly && !p.level.name.ToUpper().StartsWith(p.name.ToUpper())) {
|
||||
if (mapOnly && !p.level.name.CaselessStarts(p.name)) {
|
||||
Player.SendMessage(p, "You may only perform that action on your own map.");
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
if (Awards.giveAward(foundPlayer, awardName))
|
||||
{
|
||||
Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " was awarded: &b" + Awards.camelCase(awardName));
|
||||
Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + " %Swas awarded: &b" + Awards.camelCase(awardName));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -68,7 +68,7 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
if (Awards.takeAward(foundPlayer, awardName))
|
||||
{
|
||||
Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " had their &b" + Awards.camelCase(awardName) + Server.DefaultColor + " award removed");
|
||||
Player.GlobalMessage(Server.FindColor(foundPlayer) + foundPlayer + " %Shad their &b" + Awards.camelCase(awardName) + " %Saward removed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ namespace MCGalaxy.Commands {
|
||||
if (grp != null) {
|
||||
if (grp.Permission >= p.group.Permission) {
|
||||
Player.SendMessage(p, "You can only ipban IPs used by players with a lower rank.");
|
||||
Player.SendMessage(p, Server.DefaultColor + opname + "(" + grp.color + grp.name + Server.DefaultColor + ") uses that IP.");
|
||||
Player.SendMessage(p, opname + "(" + grp.color + grp.name + Server.DefaultColor + ") uses that IP.");
|
||||
Server.s.Log(p.name + "failed to ipban " + message + " - IP is also used by: " + opname + "(" + grp.name + ")");
|
||||
return;
|
||||
}
|
||||
@ -102,11 +102,11 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null) {
|
||||
Server.IRC.Say(message.ToLower() + " was ip-banned by " + p.name + ".");
|
||||
Server.s.Log("IP-BANNED: " + message.ToLower() + " by " + p.name + ".");
|
||||
Player.GlobalMessage(message + " was &8ip-banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
|
||||
Player.GlobalMessage(message + " was &8ip-banned %Sby " + p.color + p.name + "%S.");
|
||||
} else {
|
||||
Server.IRC.Say(message.ToLower() + " was ip-banned by console.");
|
||||
Server.s.Log("IP-BANNED: " + message.ToLower() + " by console.");
|
||||
Player.GlobalMessage(message + " was &8ip-banned" + Server.DefaultColor + " by console.");
|
||||
Player.GlobalMessage(message + " was &8ip-banned %S by (console).");
|
||||
}
|
||||
Server.bannedIP.Add(message);
|
||||
Server.bannedIP.Save("banned-ip.txt", false);
|
||||
|
@ -76,15 +76,15 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
if (p != null)
|
||||
{
|
||||
Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
|
||||
Player.GlobalMessage(message + " was &8(unbanned) %Sby " + p.color + p.name + "%S.");
|
||||
Server.s.Log("UNBANNED: by " + p.name);
|
||||
Server.IRC.Say(message + " was unbanned by " + p.name + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.GlobalMessage(message + " was &8(unbanned)" + Server.DefaultColor + " by console.");
|
||||
Player.GlobalMessage(message + " was &8(unbanned) %Sby (console).");
|
||||
Server.s.Log("UNBANNED: by console");
|
||||
Server.IRC.Say(message + " was unbanned by console.");
|
||||
Server.IRC.Say(message + " was unbanned by (console).");
|
||||
}
|
||||
Group.findPerm(LevelPermission.Banned).playerList.Remove(message);
|
||||
if (Ban.DeleteBan(message))
|
||||
|
@ -79,11 +79,11 @@ namespace MCGalaxy.Commands
|
||||
|
||||
if (votesYes + votesNo < Server.voteKickVotesNeeded)
|
||||
{
|
||||
Player.GlobalMessage("Not enough votes were made. " + who.color + who.DisplayName + " " + Server.DefaultColor + "shall remain!");
|
||||
Player.GlobalMessage("Not enough votes were made. " + who.color + who.DisplayName + " %Sshall remain!");
|
||||
}
|
||||
else if (netVotesYes > 0)
|
||||
{
|
||||
Player.GlobalMessage("The people have spoken, " + who.color + who.DisplayName + " " + Server.DefaultColor + "is gone!");
|
||||
Player.GlobalMessage("The people have spoken, " + who.color + who.DisplayName + " %Sis gone!");
|
||||
who.Kick("Vote-Kick: The people have spoken!");
|
||||
}
|
||||
else
|
||||
|
@ -43,20 +43,20 @@ namespace MCGalaxy.Commands
|
||||
if (message == "") { Help(p); return; }
|
||||
if (message.IndexOf(' ') != -1) //Yay parameters
|
||||
{
|
||||
string[] parameters = message.Split(' ');
|
||||
string[] args = message.Split(' ');
|
||||
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (parameters[i] == "layer" || parameters[i] == "l") layer = true;
|
||||
else if (parameters[i] == "1" || parameters[i] == "2color") popType = 1;
|
||||
else if (parameters[i] == "2" || parameters[i] == "1color") popType = 2;
|
||||
else if (parameters[i] == "3" || parameters[i] == "2gray") popType = 3;
|
||||
else if (parameters[i] == "4" || parameters[i] == "1gray") popType = 4;
|
||||
else if (parameters[i] == "5" || parameters[i] == "bw") popType = 5;
|
||||
else if (parameters[i] == "6" || parameters[i] == "gray") popType = 6;
|
||||
if (args[i] == "layer" || args[i] == "l") layer = true;
|
||||
else if (args[i] == "1" || args[i] == "2color") popType = 1;
|
||||
else if (args[i] == "2" || args[i] == "1color") popType = 2;
|
||||
else if (args[i] == "3" || args[i] == "2gray") popType = 3;
|
||||
else if (args[i] == "4" || args[i] == "1gray") popType = 4;
|
||||
else if (args[i] == "5" || args[i] == "bw") popType = 5;
|
||||
else if (args[i] == "6" || args[i] == "gray") popType = 6;
|
||||
}
|
||||
|
||||
message = parameters[parameters.Length - 1];
|
||||
message = args[args.Length - 1];
|
||||
}
|
||||
if (message.IndexOf('/') == -1 && message.IndexOf('.') != -1)
|
||||
{
|
||||
@ -146,12 +146,12 @@ namespace MCGalaxy.Commands
|
||||
if (popType == 1) popType = 2;
|
||||
if (popType == 3) popType = 4;
|
||||
}
|
||||
List<FindReference.ColorBlock> refCol = FindReference.popRefCol(popType);
|
||||
FindReference.ColorBlock colblock;
|
||||
ImagePalette.ColorBlock[] refCol = ImagePalette.GetPalette(popType);
|
||||
ImagePalette.ColorBlock colblock;
|
||||
p.SendMessage("" + direction);
|
||||
Thread printThread = new Thread(new ThreadStart(delegate
|
||||
{
|
||||
double[] distance = new double[refCol.Count]; // Array of distances between color pulled from image to the referance colors.
|
||||
double[] distance = new double[refCol.Length]; // Array of distances between color pulled from image to the referance colors.
|
||||
|
||||
int position; // This is the block selector for when we find which distance is the shortest.
|
||||
|
||||
@ -317,9 +317,10 @@ namespace MCGalaxy.Commands
|
||||
Player.SendMessage(p, "/imageprint <switch> <localfile> - Print local file in extra/images/ folder. Must be type .bmp, type filename without extension.");
|
||||
Player.SendMessage(p, "/imageprint <switch> <imgurfile.extension> - Print IMGUR stored file. Example: /i piCCm.gif will print www.imgur.com/piCCm.gif. Case-sensitive");
|
||||
Player.SendMessage(p, "/imageprint <switch> <webfile> - Print web file in format domain.com/folder/image.jpg. Does not need http:// or www.");
|
||||
Player.SendMessage(p, "Available switches: (&f1" + Server.DefaultColor + ") 2-Layer Color image, (&f2" + Server.DefaultColor + ") 1-Layer Color Image, (&f3" + Server.DefaultColor + ") 2-Layer Grayscale, (&f4" + Server.DefaultColor + ") 1-Layer Grayscale, (%f5" + Server.DefaultColor + ") Black and White, (&f6" + Server.DefaultColor + ") Mathematical Grayscale");
|
||||
Player.SendMessage(p, "Available switches: (&f1%S) 2-Layer Color image, (&f2%S) 1-Layer Color Image, " +
|
||||
"(&f3%S) 2-Layer Grayscale, (&f4%S) 1-Layer Grayscale, (%f5%S) Black and White, (&f6%S) Mathematical Grayscale");
|
||||
Player.SendMessage(p, "Local filetypes: .bmp. Remote Filetypes: .gif .png .jpg .bmp. PNG and GIF may use transparency");
|
||||
Player.SendMessage(p, "Use switch (&flayer" + Server.DefaultColor + ") or (&fl" + Server.DefaultColor + ") to print horizontally.");
|
||||
Player.SendMessage(p, "Use switch (&flayer%S) or (&fl%S) to print horizontally.");
|
||||
}
|
||||
|
||||
struct CatchPos { public bool layer; public byte popType; public string bitmapLoc; public ushort x, y, z; }
|
||||
|
@ -32,7 +32,7 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
if (p.modeType != 0)
|
||||
{
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + Server.DefaultColor + " mode: &cOFF");
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + " %Smode: &cOFF");
|
||||
p.modeType = 0;
|
||||
}
|
||||
else
|
||||
@ -59,13 +59,13 @@ namespace MCGalaxy.Commands
|
||||
|
||||
if (p.modeType == b)
|
||||
{
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + Server.DefaultColor + " mode: &cOFF");
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + Server.DefaultColor + " %Smode: &cOFF");
|
||||
p.modeType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.modeType = b;
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + Server.DefaultColor + " mode: &aON");
|
||||
Player.SendMessage(p, "&b" + Block.Name(p.modeType)[0].ToString().ToUpper() + Block.Name(p.modeType).Remove(0, 1).ToLower() + Server.DefaultColor + " %Smode: &aON");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
public static string GetLogoutMessage(Player p) {
|
||||
if (p.name == null) return "Disconnected";
|
||||
if (!Directory.Exists("text/logout"))
|
||||
Directory.CreateDirectory("text/logout");
|
||||
string path = "text/logout/" + p.name.ToLower() + ".txt";
|
||||
|
@ -1,459 +0,0 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MCGalaxy.Drawing {
|
||||
|
||||
internal static class FindReference {
|
||||
public static List<ColorBlock> popRefCol(byte popType)
|
||||
{
|
||||
ColorBlock tempref = new ColorBlock();
|
||||
List<ColorBlock> refCol = new List<ColorBlock>();
|
||||
refCol.Clear();
|
||||
//FRONT LAYER BLOCKS
|
||||
if (popType == 1) //poptype 1 = 2-layer color image
|
||||
{
|
||||
//FRONT LAYER BLOCKS
|
||||
tempref.r = 128;
|
||||
tempref.g = 86;
|
||||
tempref.b = 57;
|
||||
tempref.type = 3;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 162;
|
||||
tempref.g = 129;
|
||||
tempref.b = 75;
|
||||
tempref.type = 5;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 244;
|
||||
tempref.g = 237;
|
||||
tempref.b = 174;
|
||||
tempref.type = 12;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 226;
|
||||
tempref.g = 31;
|
||||
tempref.b = 38;
|
||||
tempref.type = 21;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 223;
|
||||
tempref.g = 135;
|
||||
tempref.b = 37;
|
||||
tempref.type = 22;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 241;
|
||||
tempref.b = 25;
|
||||
tempref.type = 23;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 127;
|
||||
tempref.g = 234;
|
||||
tempref.b = 26;
|
||||
tempref.type = 24;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 25;
|
||||
tempref.g = 234;
|
||||
tempref.b = 20;
|
||||
tempref.type = 25;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 31;
|
||||
tempref.g = 234;
|
||||
tempref.b = 122;
|
||||
tempref.type = 26;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 27;
|
||||
tempref.g = 239;
|
||||
tempref.b = 225;
|
||||
tempref.type = 27;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 99;
|
||||
tempref.g = 166;
|
||||
tempref.b = 226;
|
||||
tempref.type = 28;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 111;
|
||||
tempref.g = 124;
|
||||
tempref.b = 235;
|
||||
tempref.type = 29;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 126;
|
||||
tempref.g = 34;
|
||||
tempref.b = 218;
|
||||
tempref.type = 30;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 170;
|
||||
tempref.g = 71;
|
||||
tempref.b = 219;
|
||||
tempref.type = 31;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 227;
|
||||
tempref.g = 39;
|
||||
tempref.b = 225;
|
||||
tempref.type = 32;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 234;
|
||||
tempref.g = 39;
|
||||
tempref.b = 121;
|
||||
tempref.type = 33;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 46;
|
||||
tempref.g = 68;
|
||||
tempref.b = 47;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 135;
|
||||
tempref.g = 145;
|
||||
tempref.b = 130;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 240;
|
||||
tempref.b = 225;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 163;
|
||||
tempref.g = 163;
|
||||
tempref.b = 163;
|
||||
tempref.type = 43; //doubleStair
|
||||
refCol.Add(tempref);
|
||||
/*
|
||||
tempref.r = 217; Turns out the back layer blocks are handled awfully.
|
||||
tempref.g = 131;
|
||||
tempref.b = 155;
|
||||
tempref.type = 55; //lightPink
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 56;
|
||||
tempref.g = 77;
|
||||
tempref.b = 24;
|
||||
tempref.type = 56; //forestGreen
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 86;
|
||||
tempref.g = 51;
|
||||
tempref.b = 28;
|
||||
tempref.type = 57; //brownWool
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 39;
|
||||
tempref.g = 51;
|
||||
tempref.b = 154;
|
||||
tempref.type = 58; //deepBlue
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 39;
|
||||
tempref.g = 117;
|
||||
tempref.b = 149;
|
||||
tempref.type = 59; //turk oys
|
||||
refCol.Add(tempref);
|
||||
*/
|
||||
// BACK LAYER BLOCKS
|
||||
|
||||
tempref.r = 57;
|
||||
tempref.g = 38;
|
||||
tempref.b = 25;
|
||||
tempref.type = 3;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 72;
|
||||
tempref.g = 57;
|
||||
tempref.b = 33;
|
||||
tempref.type = 5;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 109;
|
||||
tempref.g = 105;
|
||||
tempref.b = 77;
|
||||
tempref.type = 12;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 41;
|
||||
tempref.g = 31;
|
||||
tempref.b = 16;
|
||||
tempref.type = 17;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 101;
|
||||
tempref.g = 13;
|
||||
tempref.b = 16;
|
||||
tempref.type = 21;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 99;
|
||||
tempref.g = 60;
|
||||
tempref.b = 16;
|
||||
tempref.type = 22;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 102;
|
||||
tempref.g = 107;
|
||||
tempref.b = 11;
|
||||
tempref.type = 23;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 56;
|
||||
tempref.g = 104;
|
||||
tempref.b = 11;
|
||||
tempref.type = 24;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 11;
|
||||
tempref.g = 104;
|
||||
tempref.b = 8;
|
||||
tempref.type = 25;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 13;
|
||||
tempref.g = 104;
|
||||
tempref.b = 54;
|
||||
tempref.type = 26;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 12;
|
||||
tempref.g = 106;
|
||||
tempref.b = 100;
|
||||
tempref.type = 27;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 44;
|
||||
tempref.g = 74;
|
||||
tempref.b = 101;
|
||||
tempref.type = 28;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 49;
|
||||
tempref.g = 55;
|
||||
tempref.b = 105;
|
||||
tempref.type = 29;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 56;
|
||||
tempref.g = 15;
|
||||
tempref.b = 97;
|
||||
tempref.type = 30;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 75;
|
||||
tempref.g = 31;
|
||||
tempref.b = 97;
|
||||
tempref.type = 31;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 101;
|
||||
tempref.g = 17;
|
||||
tempref.b = 100;
|
||||
tempref.type = 32;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 104;
|
||||
tempref.g = 17;
|
||||
tempref.b = 54;
|
||||
tempref.type = 33;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 20;
|
||||
tempref.g = 30;
|
||||
tempref.b = 21;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 60;
|
||||
tempref.g = 64;
|
||||
tempref.b = 58;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 102;
|
||||
tempref.g = 107;
|
||||
tempref.b = 100;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 0;
|
||||
tempref.g = 0;
|
||||
tempref.b = 0;
|
||||
tempref.type = 49;
|
||||
refCol.Add(tempref);
|
||||
|
||||
}
|
||||
else if (popType == 2) // poptype 2 = 1 layer color image
|
||||
{
|
||||
tempref.r = 128;
|
||||
tempref.g = 86;
|
||||
tempref.b = 57;
|
||||
tempref.type = 3;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 162;
|
||||
tempref.g = 129;
|
||||
tempref.b = 75;
|
||||
tempref.type = 5;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 244;
|
||||
tempref.g = 237;
|
||||
tempref.b = 174;
|
||||
tempref.type = 12;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 93;
|
||||
tempref.g = 70;
|
||||
tempref.b = 38;
|
||||
tempref.type = 17;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 226;
|
||||
tempref.g = 31;
|
||||
tempref.b = 38;
|
||||
tempref.type = 21;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 223;
|
||||
tempref.g = 135;
|
||||
tempref.b = 37;
|
||||
tempref.type = 22;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 241;
|
||||
tempref.b = 25;
|
||||
tempref.type = 23;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 127;
|
||||
tempref.g = 234;
|
||||
tempref.b = 26;
|
||||
tempref.type = 24;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 25;
|
||||
tempref.g = 234;
|
||||
tempref.b = 20;
|
||||
tempref.type = 25;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 31;
|
||||
tempref.g = 234;
|
||||
tempref.b = 122;
|
||||
tempref.type = 26;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 27;
|
||||
tempref.g = 239;
|
||||
tempref.b = 225;
|
||||
tempref.type = 27;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 99;
|
||||
tempref.g = 166;
|
||||
tempref.b = 226;
|
||||
tempref.type = 28;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 111;
|
||||
tempref.g = 124;
|
||||
tempref.b = 235;
|
||||
tempref.type = 29;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 126;
|
||||
tempref.g = 34;
|
||||
tempref.b = 218;
|
||||
tempref.type = 30;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 170;
|
||||
tempref.g = 71;
|
||||
tempref.b = 219;
|
||||
tempref.type = 31;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 227;
|
||||
tempref.g = 39;
|
||||
tempref.b = 225;
|
||||
tempref.type = 32;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 234;
|
||||
tempref.g = 39;
|
||||
tempref.b = 121;
|
||||
tempref.type = 33;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 46;
|
||||
tempref.g = 68;
|
||||
tempref.b = 47;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 135;
|
||||
tempref.g = 145;
|
||||
tempref.b = 130;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 240;
|
||||
tempref.b = 225;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 0;
|
||||
tempref.g = 0;
|
||||
tempref.b = 0;
|
||||
tempref.type = 49;
|
||||
refCol.Add(tempref);
|
||||
}
|
||||
else if (popType == 3) //2-Layer Gray Scale
|
||||
{
|
||||
//FRONT LAYER
|
||||
tempref.r = 46;
|
||||
tempref.g = 68;
|
||||
tempref.b = 47;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 135;
|
||||
tempref.g = 145;
|
||||
tempref.b = 130;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 240;
|
||||
tempref.b = 225;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
//BACK LAYER
|
||||
tempref.r = 20;
|
||||
tempref.g = 30;
|
||||
tempref.b = 21;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 60;
|
||||
tempref.g = 64;
|
||||
tempref.b = 58;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 102;
|
||||
tempref.g = 107;
|
||||
tempref.b = 100;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 0;
|
||||
tempref.g = 0;
|
||||
tempref.b = 0;
|
||||
tempref.type = 49;
|
||||
refCol.Add(tempref);
|
||||
}
|
||||
else if (popType == 4) //1-Layer grayscale
|
||||
{
|
||||
tempref.r = 46;
|
||||
tempref.g = 68;
|
||||
tempref.b = 47;
|
||||
tempref.type = 34;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 135;
|
||||
tempref.g = 145;
|
||||
tempref.b = 130;
|
||||
tempref.type = 35;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 230;
|
||||
tempref.g = 240;
|
||||
tempref.b = 225;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 0;
|
||||
tempref.g = 0;
|
||||
tempref.b = 0;
|
||||
tempref.type = 49;
|
||||
refCol.Add(tempref);
|
||||
}
|
||||
else if (popType == 5) // Black and white 1 layer
|
||||
{
|
||||
tempref.r = 255;
|
||||
tempref.g = 255;
|
||||
tempref.b = 255;
|
||||
tempref.type = 36;
|
||||
refCol.Add(tempref);
|
||||
tempref.r = 0;
|
||||
tempref.g = 0;
|
||||
tempref.b = 0;
|
||||
tempref.type = 49;
|
||||
refCol.Add(tempref);
|
||||
}
|
||||
return refCol;
|
||||
}
|
||||
|
||||
public struct ColorBlock {
|
||||
public ushort x, y, z; public byte type, r, g, b, a;
|
||||
}
|
||||
}
|
||||
}
|
143
Drawing/ImagePalette.cs
Normal file
143
Drawing/ImagePalette.cs
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
Copyright 2011 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MCGalaxy.Drawing {
|
||||
|
||||
internal static class ImagePalette {
|
||||
|
||||
public static ColorBlock[] GetPalette(byte type) {
|
||||
if (type == 1) return Color_2; // 2-Layer color
|
||||
if (type == 2) return Color_1; // 1-Layer color
|
||||
if (type == 3) return Grayscale_2; // 2-Layer grayscale
|
||||
if (type == 4) return Grayscale_1; // 1-Layer grayscale
|
||||
if (type == 5) return BlackWhite_1; // 1-Layer Black and white
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static ColorBlock[] Color_2 = {
|
||||
//FRONT LAYER BLOCKS
|
||||
new ColorBlock(128, 86, 57, 3),
|
||||
new ColorBlock(162, 129, 75, 5),
|
||||
new ColorBlock(244, 237, 174, 12),
|
||||
new ColorBlock(226, 31, 38, 21),
|
||||
new ColorBlock(223, 135, 37, 22),
|
||||
new ColorBlock(230, 241, 25, 23),
|
||||
new ColorBlock(127, 234, 26, 24),
|
||||
new ColorBlock(25, 234, 20, 25),
|
||||
new ColorBlock(31, 234, 122, 26),
|
||||
new ColorBlock(27, 239, 225, 27),
|
||||
new ColorBlock(99, 166, 226, 28),
|
||||
new ColorBlock(111, 124, 235, 29),
|
||||
new ColorBlock(126, 34, 218, 30),
|
||||
new ColorBlock(170, 71, 219, 31),
|
||||
new ColorBlock(227, 39, 225, 32),
|
||||
new ColorBlock(234, 39, 121, 33),
|
||||
new ColorBlock(46, 68, 47, 34),
|
||||
new ColorBlock(135, 145, 130, 35),
|
||||
new ColorBlock(230, 240, 225, 36),
|
||||
new ColorBlock(163, 163, 163, 43),
|
||||
/*Turns out the back layer blocks are handled awfully.
|
||||
new ColorBlock(217, 131, 155, 55),
|
||||
new ColorBlock(56, 77, 24, 56),
|
||||
new ColorBlock(86, 51, 28, 57),
|
||||
new ColorBlock(39, 51, 154, 58),
|
||||
new ColorBlock(39, 117, 149, 59),*/
|
||||
|
||||
// BACK LAYER BLOCKS
|
||||
new ColorBlock(57, 38, 25, 3),
|
||||
new ColorBlock(72, 57, 33, 5),
|
||||
new ColorBlock(109, 105, 77, 12),
|
||||
new ColorBlock(41, 31, 16, 17),
|
||||
new ColorBlock(101, 13, 16, 21),
|
||||
new ColorBlock(99, 60, 16, 22),
|
||||
new ColorBlock(102, 107, 11, 23),
|
||||
new ColorBlock(56, 104, 11, 24),
|
||||
new ColorBlock(11, 104, 8, 25),
|
||||
new ColorBlock(13, 104, 54, 26),
|
||||
new ColorBlock(12, 106, 100, 27),
|
||||
new ColorBlock(44, 74, 101, 28),
|
||||
new ColorBlock(49, 55, 105, 29),
|
||||
new ColorBlock(56, 15, 97, 30),
|
||||
new ColorBlock(75, 31, 97, 31),
|
||||
new ColorBlock(101, 17, 100, 32),
|
||||
new ColorBlock(104, 17, 54, 33),
|
||||
new ColorBlock(20, 30, 21, 34),
|
||||
new ColorBlock(60, 64, 58, 35),
|
||||
new ColorBlock(102, 107, 100, 36),
|
||||
new ColorBlock(0, 0, 0, 49),
|
||||
};
|
||||
|
||||
internal static ColorBlock[] Color_1 = {
|
||||
new ColorBlock(128, 86, 57, 3),
|
||||
new ColorBlock(162, 129, 75, 5),
|
||||
new ColorBlock(244, 237, 174, 12),
|
||||
new ColorBlock(93, 70, 38, 17),
|
||||
new ColorBlock(226, 31, 38, 21),
|
||||
new ColorBlock(223, 135, 37, 22),
|
||||
new ColorBlock(230, 241, 25, 23),
|
||||
new ColorBlock(127, 234, 26, 24),
|
||||
new ColorBlock(25, 234, 20, 25),
|
||||
new ColorBlock(31, 234, 122, 26),
|
||||
new ColorBlock(27, 239, 225, 27),
|
||||
new ColorBlock(99, 166, 226, 28),
|
||||
new ColorBlock(111, 124, 235, 29),
|
||||
new ColorBlock(126, 34, 218, 30),
|
||||
new ColorBlock(170, 71, 219, 31),
|
||||
new ColorBlock(227, 39, 225, 32),
|
||||
new ColorBlock(234, 39, 121, 33),
|
||||
new ColorBlock(46, 68, 47, 34),
|
||||
new ColorBlock(135, 145, 130, 35),
|
||||
new ColorBlock(230, 240, 225, 36),
|
||||
new ColorBlock(0, 0, 0, 49),
|
||||
};
|
||||
|
||||
internal static ColorBlock[] Grayscale_2 = {
|
||||
//FRONT LAYER
|
||||
new ColorBlock(46, 68, 47, 34),
|
||||
new ColorBlock(135, 145, 130, 35),
|
||||
new ColorBlock(230, 240, 225, 36),
|
||||
//BACK LAYER
|
||||
new ColorBlock(20, 30, 21, 34),
|
||||
new ColorBlock(60, 64, 58, 35),
|
||||
new ColorBlock(102, 107, 100, 36),
|
||||
new ColorBlock(0, 0, 0, 49),
|
||||
};
|
||||
|
||||
internal static ColorBlock[] Grayscale_1 = {
|
||||
new ColorBlock(46, 68, 47, 34),
|
||||
new ColorBlock(135, 145, 130, 35),
|
||||
new ColorBlock(230, 240, 225, 36),
|
||||
new ColorBlock(0, 0, 0, 49),
|
||||
};
|
||||
|
||||
internal static ColorBlock[] BlackWhite_1 = {
|
||||
new ColorBlock(255, 255, 255, 36),
|
||||
new ColorBlock(0, 0, 0, 49),
|
||||
};
|
||||
|
||||
public struct ColorBlock {
|
||||
public ushort x, y, z; public byte type, r, g, b, a;
|
||||
|
||||
public ColorBlock(byte r, byte g, byte b, byte type) {
|
||||
this.r = r; this.g = g; this.b = b; this.type = type;
|
||||
x = 0; y = 0; z = 0; a = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -547,7 +547,7 @@
|
||||
<Compile Include="Server\Extra\UPnP.cs" />
|
||||
<Compile Include="Database\SQLite.cs" />
|
||||
<Compile Include="Database\SQLiteTransactionHelper.cs" />
|
||||
<Compile Include="Drawing\FindReference.cs" />
|
||||
<Compile Include="Drawing\ImagePalette.cs" />
|
||||
<Compile Include="Server\Colors.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Player\PlayerCollection.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user